Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Creating An Instance In The Middle Of A Movie



Is there a way to place an instance of a movie clip from the library while a movie is running and place it at a specific location on the screen? Thanks.



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 09-23-2008, 11:06 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Creating Instance Of Button (movie)
I have been beating my head on the wall for 2 days with something that is probably simple as heck - - I am trying to create multiple instances of an advanced button that a guy gave me - it is a movie clip that has buttons and movie clips inside it - - when i create new instances, the other buttons change with it - - i realize that when i double click that it changes the master symbol - so HOW DO I modify text and actionscript under a movie clip without double clicking on it ??? many thanks for any help

-Kevin
Dallas, Texas

Creating An Instance Of A Movie Clip?
Hi, hopefully someone can answer this beginner question.

When a button is pressed, I'd like to make an instance of a movie clip (called "square") at X=100, Y=100.

I'm guessing it would be

on(press){

CODE FOR CREATING AN INSTANCE OF A MOVIE CLIP????

}


thanks for the help!

Creating A Movie Clip Instance?
First of all, I'm new to Flash and the forums so hi everyone !

Okay, so I created a bullet movie clip, and I'm just wondering how could I make it so that when the user clicks anywhere on the screen with the mouse, it creates an instance of the bullet.

Thanks!

Dynamically Creating Instance Name Of Movie Clip
Hi everyone

a shove inthe right direction very much needed.

I have a movie clip (Lets call it mc01.swf) that I am loadin on my main movie.
this movioe clip is loaded inside an empty container in my main movie. the contaner mc han instant name "contmc"

I want to stop the loaded Mc i.e mc01.swf whcih is loading inside the empty container.

any idea how i can target the time line of teh loaded movieclip??

thanks for your help

P.S. im using flash MX

[F8] Creating A New Instance Of A Movie Clip With Actionscript
Hello,

I have a button in my flash document. whenever it is pressed, i would like to create a new instance of a movieclip in my library and pass it parameter (an image file name to display)

how can i do this?

Copying Movie Clips & Creating New Instance
Hi, Helpful People!

I'm new to the forum and have been struggling with this issue all day.  I'm not even sure if my subject line is accurate.  hahaha.  I'm currently making changes to a website (tukansystems.com).  Each button on this site links to a standard movie clip that loads a variable.  I've created a new button and am trying to forego the creation of the movie clip by copying it and changing the actionscript/variable.  However, when I try this upon clicking the buttons, they both display the same .txt file, as if they are linked.  How can I get around this problem??

Thanks in advance

t

[MX04] Duplicating/Creating Instance Of Movie Clips
Greetings,

Im WIP in creating a game which has movieclips (bullet and live symbols) dotted on the stage but not in the visible runtime view.

These movieclips are then duplicated when required. The bullets have code attached to the movieclips however the lives symbols don't.

Is this common practise to have movieclips hidden offscreen and then duplicated to create an instance when required or is their a cleaner method to create an instance of a movieclip?

Hope that makes sense.

Thanks
Rob

Movie Slows Down In The Middle; Why?
Here's my 1st real attempt at a movie from scratch:
http://www.mechphisto.net/storage/clouds3.html

In the middle, it slows down. I know because those little balls of light that move are 10 frame tweens, repeated 9 times from beginning of the movie to end. For a couple of the tween sets, they go slow, then pick back up.
Why would they do that, and is there something I'm missing that can prevent it? Like, "Allow frame drop during heavy processing to prevent slowness" or some magic setting like that? =)

Thanks for any help!
Liam
druid -at- celticbear -dot- com

Want Movie To Be In Middle Of Browser
How do I make my movie appear in the middle of the browser.
I've looked at some tutorials on publishing the .html file, but I'm still stumped.

Thanks

Loading In The Middle Of A Movie
Hey all,

Does anyone know anyway to load a flash movie from the middle, so, as an example...

I have 100 frames, every 10 frames I have a frame name and I want to random which frame it starts on.

Can I tell flash start loading at frame 5, and stream the loading from there?

Thanks
Caden

Preloader Loads Movie In The Middle
Preloader works, although my music from the loading SWF file begins playing right away during the preloading phase. But when the movie does begin playing, it starts in the middle somewhere. (almost as if it is trying to catch up to where the music is at?) Sound event is set at Start and to Loop in frame 11 of the movie. http://welcome.wisnet.com/strukel/www/senior_gallery.iml
You'll only see it happen the first time, after that the file is cached and it will play from the beginning like it's supposed to. Any suggestions? thanks, Julie

Movie Occasionally Stalls In Middle--WHY?
Hello,

I created a Flash movie that is an online test. There are many audio files that get downloaded before the movie starts to play. Most of the time, the movie works just fine and users can take the test through to the finish. However, sometimes the test stalls after one of the test sections (which is a Scene in the Flash movie) and the user cannot continue. Often, if they reboot and restart the test, it works fine. I was hoping one of you experts could perhaps help me with:

-what could be causing this behavior? If the downloaded files are too big, then how can I clear some of the RAM after the audio files have been played?

-I thought once a movie was compiled it would play. I am just baffled as to what could be causing these occasional stalls.

I just don't know where to start looking as it doesn't always stall and when it does stall/stop, it is not always after the same scene.

-Is there a technique to ensure the movie will never stall?

Any help/thoughts would be much appreciated!

Thanks!

Creating An Instance Of A DLL
Does anyone know how to call a DLL using actionscript. I am trying to call the objects in a DLL and I am not having any luck finding the ActionScript that will create the instance of a DLL and let you pass and recieve parameters from it.

Creating An Instance?
man i downloaded this tut on making your site in flash and i have spent hours trying to find out how to create an instance searching through docs and tuts and I have no been able to figure out what the dood in the tut means bye creating an instance of a button what the hell does he mean sombody plz help and yes i made the gun using photo shop 7 but It is distorted because i had to make it small anough to put on here

Creating Mc Instance
how can i create movieclip instance through as?

thanks
-mad_man

Creating Mc Instance
how can i create movieclip instance through as?

thanks
-mad_man

How Do I Change Frame Rate In The Middle Of A Movie?
How do I change frame rate in the middle of a movie? Please tell me, I need to know!

Adding Or Removing Time From Middle Of Movie
I have a long involved, interactive movie. I've noticed that I forgot to include some things that belong in the middle of the movie. Or I have some thing in the middle of the movie that I no longer need and want to remove. What is the best way to do this?

This is not a problem for a simple movie: 100 frames and just one layer. You just go up to your time line and move stuff around.

This seems to be much more of a problem in a large movie: 1000's of frame and say 50 layers. Moving items on a single layer is, again, relatively easy. It's keeping all the other layers in synch that is difficult (at least for me).

Using ActiongScript, I can put a gotoAndPlay(some_frame_label) and jump about the movie, thereby "adding" time in the middle or perhaps skipping over a section of the movie. While this is okay for a few changes and the movie displays properly, the underlying structure soon gets ugly. Get too many such edits and your movie may not be maintainable.

As an analogy: in an Excel spreadsheet, you can insert or delete a row. When you do, everything to the right moves over or back to accomodate the change. In Flash MX, I would like to be able to go to frame 100 and insert 10 frames of space (or remove them for that matter). This would allow me to insert things I've forgotten or remove things no longer needed.

Again, this is no big deal with one layer and 100 frames. It is an entirely different matter with potentially 10s to 100s of layers and 1000s to 10,000s of frame.

Starting A Movie In The Middle If Previously Viewed
I need to detect when a movie has been played on a previous visit to the page so that it can play from a different spot on the timeline.

I know this is a cookie issue, but I don't know how to tell the movie to start at frame 89 instead of frame 1.

Any ideas?

Looping Movie Clip Stops In Middle
I am using a movie clip as part of a game. It's a clip of a spaceman walking.
When the game is being played, the movie seems to loop one time (the spaceman walks one cycle), and on the second time around the animation seems to stop right in the middle of the cycle. it always stops on the same frame.
What is happening here?
Thank you

LoadMovie Doesn't Work In The Middle Of My Movie
Hello,
I have been trying to create a photo gallery. Where in this gallary appears after a long period of animation.

Every single thing in the site is externally loaded. when I reach the gallary set of frames. I am not able to load external images. "loadMovie" doesn't work. If I do this right at the beginning of the movieclip, "loadMovie" works but not somewhere in the middle of movieclip.

Please help!!

LoadMovie Doesn't Work In The Middle Of My Movie
Hello,
I have been trying to create a photo gallery. Where in this gallary appears after a long period of animation.

Every single thing in the site is externally loaded. when I reach the gallary set of frames. I am not able to load external images. "loadMovie" doesn't work. If I do this right at the beginning of the movieclip, "loadMovie" works but not somewhere in the middle of movieclip.

Please help!!

Duplicating, Not Creating An Instance
Hi

When I duplicate stuff in my library I want to be able to modify the contents with out affecting the original copy. I want to make a copy, not a reference to a library item. The reason is I have a movie clip I made but I want to change the text inside of it to make a new movie clip. When I duplicate it and change the text the original changes too. How can I avoid this.

Thanks for your time
ktpr

[F8] Shortcut To Creating MC Name And Instance Name?
Is there a way - when creating an MC - to give it the MC name and instance name at the same time?

I have a LOT of images and text imported in from Illustrator that I need to animate and having to name everything twice is a real pain!

A plugin/extension of some sort perhaps?

Creating An Instance Of An External Swf
Hi,

I would like to create an instance of an external swf at runtime. As far as I know there is no way to add resources to the library at runtime. Usually you would use loadMovie to load an external swf or jpg. But, my external movie is pretty big and I need multiple instances of it. This means that when using loadMovie, the external (big) movie will be loaded serveral times into memory (since flash regards them all to be different movies).

Anyone any suggestions how to tackle this problem?

- Pan

Creating A New Recorded Instance
Hi,

I have managed to get my webcam to record to fms but only one instance, it just replaces the file each time it records, does anyone know the way to make new instances, there is a thread on here somewhere about it but have managed to lose it!

thanks for your help

Gavin

Creating A Class Instance
Hi, trying to create a class instance and keep getting this error:

Error: Error #2136: The SWF file file:///Kenny/Workspaces/Jim/flashVideo/src/FlashVideo.swf contains invalid data.
at FlashVideo()

Below is the code for the 2 as files I'm using. FlashVideo is supposed to call MousePosition







Attach Code

// .................................FlashVideo.as

package
{
import flash.display.Sprite;
import flash.display.*;
import flash.events.*;

public class FlashVideo extends Sprite {


public function FlashVideo () {


trace ("FlashVideo has run");
var position = new MousePosition();

}
}
}



//......................... MousePosition.as

package
{
public class MousePosition extends FlashVideo {


public function MousePosition ()
{
trace ("MousePosition has run");

}
}
}

Pictures Top Left Corner Is In Middle Of Movie Control?
I'm loading an image in a movie control shape. Though, the top left image appears in the middle of the box. How can I move the point where the top left corner of the image will appear?

Link To The Middle Of A Movie Clip On A Scene From Another Movieclip
I have a flash file with two scenes. I have a separate movie clip(mc) on each scene. I want a user to be able to click a button at the end of the mc on scene 2(scene 2 is called "com") that will take them to the middle of the mc on scene 1.

I created a frame label in the middle of mc on scene 1 called "mob_scene" and used the following code to link to it but it goes to the start of the mc rather than the middle. What am I doing wrong?

I have tried the following code:

on(press){
_root.gotoAndPlay("main_mob")
}

I have also tried a linking to a frame label in the middle of the main timeline on scene 1 but it still goes back to the start.

Any ideas?

Caroline

Static Background Image With Flash Movie In Middle
How would I go about setting up a site like this one?

http://www.takingbacksunday.com/whereyouwanttobesite/

I want to have a normal repeating .jpg for the background, with the content centered in the middle.

I'm sure its a very simple answer, but I'm just curious.

OnPress In The Middle Of A Rollover/rollout Movie Clip
Basically I have a movie clip where the user rolls over a graphic and another graphic on the screen goes from small to large. When they roll out, it goes back to small. What I want to do is have it so when they click the first graphic, the second graphic that has become large will do something else. can i put this in the same movie clip and how? thanks

Loadmovie Into A Movie Clip But In The Middle Of The Movieclip Instead Of The Topleft
I have a movie clip that loads a movie.

For example: loadMovie("news.swf", _root.loader);

I want the news.swf to load into loader MC. It does, but it loads from the top left of the MC. I want it to load from the very middle of the MC. I tried to make the MC's point(I forget what that is called when you create a symbol and select what point you want it in[top left, left, bottom left, middle, bottom mid, top mid, top right, right, bottom right..etc]) in the middle. It didnt help though.. Any idea on how to make a movie load from the middle of an MC? Or an alternate idea.

Centre Flash Movie In Middle Of Html Page?
Hi everyone.
I've just followed lee's tutorial on full browser flash. I have applied this technique to my site and all has worked well. The flash movie takes up the whole browser window, i have fixed the active x problem in IE and everything works as per normal.
I have one very annoying problem though, and that is that whenever i publish my .swf from flash, it creates my index.html page which is all good, but i can not figure out how on earth i center the swf file in the middle on the html page with an equal margin between the bottom of the swf file and the top of the swf file.
To see what i'm talking about here, goto http://www.jacksrambles.com
As you can see the swf file take up the whole browser window, and the tile graphic is tiled correctly, but the actual swf file sit at the top left of the browser window.
Any ideas?
Thanks, JacoX

Prototype Creating Unwanted New Instance, Help
I've got a custom class called lo. Each time a new lo is created, it adds 1 to a global counter called totalLO.

code:
_global.lo = function(loNumber,parentModule) {
_global.totalLO = totalLO + 1 ;
loNode = moduleNode.childNodes[loNumber];
this.lo_number = loNumber;
// and so on and so forth
}


However, I have 2 other buttons that I'm assigning lo as a prototype to.

When I use:

code:
myClass.prototype = new lo();
myOtherClass.prototype = new lo();


It must actually create two new empty lo somewhere, because my totalLO counter is off by 2.

I need my totalLO counter to be accurate. What can I do?

Weird Thing When Creating Instance
I put my movieclip on the authoring mode from the library named them "A","B","C", respectively from the properties panel.. duh.. as simple is that !!!
the funny thing is when I debug my flash and show the list of object there are no "C" but instead it's "instance3".. but it's okay with A & B..
what happened ? I'm using MX2004.. will the patch help me ?

Creating Dynamic Instance Names
Hi,

I have a mc called "qu" on the stage which contains text boxes with instance names q1,q2...q10 and a1,a2...a10. I want to target these boxes from the main time line. However, rather than just targeting each individually from the maintime line like this

q1._visible = false

i want to target them dynamically using a counter from the maintime line. ie:

question = this["q"+i]
qu.question._visible = false

This does not work. However when i apply the following code inside the qu mc rather than the maintime line it does work:
this["q"+i]._visible = false

I hope this is clear what im talking about. can anyone help me to target these text boxes from the main time line properly?
thanks
john

Creating An Instance Of A Custom Class
Hey!

I'm quite new to OOP in AS3 (I've worked alot with OOP in VB.Net but it's a bit different). I wonder how I can import a custom class to my flash file. I think it shouldn't be too hard, but I've looked at alot of forums but none have given me a solution.

I have a main file (it's supposed to become my photo gallery).
I also have a folder, named "classes".
In the "classes" folder, I have a file named "claAlbum.as". It looks like this:


Quote:




package {
class Album{
import flash.display.Sprite;
public var strTittel:String;
public var dteDatoate;
public var intAntall:int;

}
}




Now what I am trying to achieve is to make an instance of this object in my main file (one level up).

Does anybody have any suggestions on how to do this? (Am I structuring things the wrong way?)

Help Creating New Public Instance Var To GotoAndPlay / OOP
If anyone can help me i would appreciate it, I am into OOP way over my head. I am trying to create navigation using OOP, and I have everything working (over, out, active, unactive) just like I want it. The problem is i can't get the buttons to go anywhere. All the normal mouse handlers are dealing with graphical states, onRelease works but i lose the "active/unactive" states.

Apparently, I need to "create new public instance variables (Function type) so I can assign from outside and call them when needed", but i have no idea how to do this.

This is the tutorial i have been working from,
http://www.gotoandlearnforum.com/vie...p?f=35&t=15091

I can post my code as well but it is almost identical (i am really a newbie to OOP).

If anyone can help me i thank you.

Dynamically Creating An Instance Of A Graphic
Ok, so I've got a graphic (or a movie clip) in my Library. (I'm Using Flash MX)

I'd like to (using ActionScript) dynamically create an instance of that graphic and place it on the stage (specifying the X and Y position).

How would I go about doing this?

Thanks

IC

Width Of A Movieclip Without Creating An Instance
Hi there. I'm adding skins to the Button component and I'm wondering if there's a way to grab the width of a movie clip without creating an instance of the movie clip on the stage.

Here's my code:


Code:

initObj = new Object();
initObj.falseUpSkin = "movSpinButtonUp";
initObj.falseDownSkin = "movSpinButtonDown";
initObj.falseOverSkin = "movSpinButtonOver";
initObj.falseDisabledSkin = "movSpinButtonDisabled";
initObj.label = "";
initObj._x = gui.getSpinButX();
initObj._y = gui.getSpinButY();
initObj._width = *** HOW TO GET movSpinButtonUp's WIDTH ***;
parentMovie.createClassObject(mx.controls.Button, "spinbutton", parentMovie.getNextHighestDepth(), initObj);
I want to be able to get the width of movSpinButtonUp and assign that width to my new button created with createClassObject() without hard-coding a numeric value.

Creating Another Instance, In Exactly The Same Position As A Current One..
Sorry for all the bad question i seem to be posing here, I think im improving slowly though

I have a carfully constructed shape that i have made from about 50 symbols. At fram 50 in my timeline i want all the symbols to become graphics rather than movies. I am looking for a better way to acieve this than creating a new instance, and posistioing it in the right place for each symbol.

Thanks,

Robin

Creating An Instance Of What A Variable Evaluates As?
trace(t[i*3]); //Prints 'a1' (without quotes)
var d = new a1(); //Works fine, creates a new instance of class a1
var d = new t[i*3](); // Does not work

But how could I make that work?

Thanks in advance.

Creating Public Instance In Function
Hello,
i need to create some instances at run-time and need to acces them from an other function.


Code:
function createEnemy(enemyCount:Number){
// I will write a loop here
var enemy1:enemy = new enemy("strong_enemy");
this.addChild(enemy1);
//loop end
}
createEnemy(7); //will create 7 enemy instance

trace(enemy1.currentStatus); //Variable enemy1 is not defined.
trace(this.enemy1.currentStatus); //Variable enemy1 is not defined.
how can i access to the public properties or public methods of enemy1 from outside of that function?

thank you for your answers..

Width Of A Movieclip Without Creating An Instance
Hi there. I'm adding skins to the Button component and I'm wondering if there's a way to grab the width of a movie clip without creating an instance of the movie clip on the stage.

Here's my code:


Code:

initObj = new Object();
initObj.falseUpSkin = "movSpinButtonUp";
initObj.falseDownSkin = "movSpinButtonDown";
initObj.falseOverSkin = "movSpinButtonOver";
initObj.falseDisabledSkin = "movSpinButtonDisabled";
initObj.label = "";
initObj._x = gui.getSpinButX();
initObj._y = gui.getSpinButY();
initObj._width = *** HOW TO GET movSpinButtonUp's WIDTH ***;
parentMovie.createClassObject(mx.controls.Button, "spinbutton", parentMovie.getNextHighestDepth(), initObj);
I want to be able to get the width of movSpinButtonUp and assign that width to my new button created with createClassObject() without hard-coding a numeric value.

Want Opening Movie Clip Instance To Close Underlying Movie Clip Instance
Just so you all know, I'm one of three people in our company that uses Flash and I'm considered "the expert". However, we don't do more than a few Flash projects a year, so my scripting knowledge is very, very green. Thanks in advance for your patience.

I have 22 buttons that play an assigned movie clip from the library. I suspect I'm building these things the wrong way (probably true), but here is how each button is constructed....

Each instance that I'm calling a button is actually identified as a movie clip intance with a button in it. It sits on its own layer. When I double-click an instance, several layers are displayed, the majority of which belong to the presentation of the movie clip. The clip lasts five frames.

The first frame consists of blank keyframes for each layer except for one layer that has stop() assigned to the frame and another layer with the actual button. The layer with stop() at frame 1 is then blank for the next three frames, and then another stop() on frame 5 (the last frame).

The button layer lasts all five frames. Here's the script for "display1980":

on (rollOver) {
_root.display1981.gotoandstop(1);
_root.display1982.gotoandstop(1);
_root.display1983.gotoandstop(1);
.
.
.
_root.display2003.gotoandstop(1);
_root.display2004.gotoandstop(1);
_root.display2005.gotoandstop(1);}

on (release) {
_root.Play();
play();
}

For each instance, there is no line of script that refers to itself. In this example for display1980, "_root.display1980.gotoandstop(1);" is not used.

As I mentioned earlier, each instance is on the main stage on its own layer. I've done this with only eight of my instances, so there are now eight layers. (There are--in fact--more than eight layers, but those are not part of this issue.)

The script I created does the job of getting rid of any previously displayed movie clip, but I created a new conumdrum: If I rollover any other button, the currently displayed clip closes. I've tried replacing "on (rollOver)" with "on (press)" but that doesn't work.

Like I said, I suspect I'm buildng this wrong. Is what I built a waste of time, or can it be salvaged? Or, is there a much better and efficient way (and I suppose there is) that can be described so that my green experience can absorb to good effect?

Creating Usable Variable Based On Instance Name
Right

I have been away from Flash for a while, but even going through my old stuff I haven't found what I am looking for... here it goes

I need to create a usable variable based on the movie clip instance name.

I manage to create the name:.

code:
var variable_name = String(this._name)+"_value";


which will generate my desired variable name (eg. myMCName_value).
The question is:

How do I use this generated name as a variable name?

I need to assign a value to it as in

code: myMCName_value = 1;

but I don't want to actually have that command line in the script. because the whole thing won't know that this variable will exist until it is created.

Did I made myself clear enough?

Creating Instance Of Random Library Item
I am trying to add 4 items to stage from the library, "Plane0", "Plane1"..."Plane3". Each uses a base class of "com.Plane", and an auto-generated class for itself (named "Plane0"..."Plane3").

com.Plane takes 4 parameters.

I use the following code to get the items on stage:


PHP Code:



// getDefinitionById is imported
for (var i:int = 0, i < 4, i++){
    var planeName:String =  "Plane" + i;
    var ClassReference:Class = getDefinitionByName(planeName) as Class;
    var myPlane:Plane = new ClassReference("param0","param1","param2","param3");
    addChild(myPlane);
}




but I get the following error:

ArgumentError: Error #1063: Argument count mismatch on Plane0$iinit(). Expected 0, got 4.

what am I missing here?

[F8] Dynamic Instance Name For Creating A New Object: Any Tutorials?
I am trying to create using Senocular's Motion Path a new Path:

_root.myPath = new Path(parameter1, parameter2);

I want to know if its possible to assign dynamically generated names (such as myPath) and store them in an array and how to reference it for other uses such as:

_root.myPath.lineTo(pointA, pointB);

Can you please suggest any tutorials or similar cases.
Thank you.

Copyright © 2005-08 www.BigResource.com, All rights reserved