Pause instance of movie clip on stage?

I've got instances of movie clips that appear in sequence
along the main timeline and would like to be able to make it so
that the user can pause and resume at their leisure. Is there a way
to accomplish this short of making the instances separate SWF/FLV
files?

i don't see that error message and i don't see a problem.

Similar Messages

  • Loading movie clip to stage with button click AS3

    I'm trying to figure out how to load a movie clip to the stage with a button click and have the movieclip close again using a close button. Does anyone have a step by step on how to do this or links to some tutorials.
    Below is an example of what I'm trying to do.

    Alrighty I changed the publish settings to as3. I'm still getting two errors:
    Scene 1
    1046: Type was not found or was not a compile-time constant: Popup1Btn.
    Scene 1, Layer 'as', Frame 1, Line 3
    1061: Call to a possibly undefined method addEventListener through a reference with static type Class.
    So my setup on my main timeline is I have an actionscript layer with this code now:
    var popup1:Popup1
    Popup1Btn.addEventListener(MouseEvent.CLICK,addF);
    ClosePopup1.addEventListener(MouseEvent.CLICK,closeF);
    function addF(e:MouseEvent):void{
    popup1=new Popup1();
    addChild(popup1);
    function closeF(e:MouseEvent):void{
    removeChild(popup1);
    popup1=null;
    On the stage I have a button with the isntance/AS linkage name Popup1Btn. Inside my Popup1 MC I have a box with text and then a button with the instance/linkage name ClosePopup1 to close the popup.
    What am I missing?

  • Putting movie clips in AS3 package into movie clip on stage

    Hi - I am a as2/flash animator and am working on an AS3
    project. The AS is in a separate file, inside a package. I am
    modifying existing code.
    The script adds movie clips in a function via addchild.
    What I am hoping to do, is have the movieclips added to a
    clip that already exists on the stage.
    I put a clip on the stage named holder, with the instance
    name holder_mc - and I tried to add the clip with
    holder_mc.addchild in the AS3 file - it seemed to work, but
    manipulating the holder_mc - it looks like the added clips are not
    affected?
    Any help is appreciated.

    Child_array is a property of the Parent class.
    It's only added to in one point, in a function that creates a
    Child and adds it to the array.
    I think I might have found out the problem with my code after
    adding a trace to the function, think I'm creating twice the number
    of clips I'm removing, and the deletion part of my code is fine!
    Turns out AS3 is maybe not so bad after all :P
    Thanks alot for taking the time to reply though kglad!

  • How to limit the number of movie clips on stage?

    I am making a game where tempEnemy in an array of enemies gets made on random. Every time the player advances a level, more insects appear. This is how I want it to be, but when the user is high on a level, too many enemies get made that are impossible for the user to kill. How can I limit the number of enemies being displayed on stage, but not hinder the randomness of the enemy production?
    function makeEnemies():void
        var chance:Number = Math.floor(Math.random() * 150);
        if (chance <=  + level)
            tempEnemy = new Enemy();
            //Math.random(); gets a random number from 0.0-1.0
            tempEnemy.x = Math.round(Math.random() * 550);
            addChild(tempEnemy);
            enemies.push(tempEnemy);
            tempEnemy.speed = enemyBaseSpeed + ((level - 1) * speedLevelInc);
             if (tempEnemy.speed > MAX_SPEED)
            tempEnemy.speed = MAX_SPEED;

    Keep a total count of the enemies that are present versus whatever maximum is currently allowed for a level and do not produce any more than the difference between the maximum and the current number of them.

  • Attach movie clip

    Hello i asked this in my another topic but that topic was
    mainly related with another problem.
    my question is;
    i have 3x3 square boxes ( "box_mc"s movie clips duplicated
    from 1 "box" movie clip on stage)
    I want to put a small box (that is movie clip "smallmc") in
    front of bigger one(that is one of another mc "box_mc" already
    placed on stage). When i click big box( i mean "box_mc") i want to
    attach an instance of "smallmc" in front of big one.
    i have this code in "box" mc ;
    on (press) {
    if (this.selected == 0) {
    trace("box is selected");
    selected = 1;
    _root.attachMovie("smallmc","smallmc"+count,getNextHighestDepth(),{_x:this._x,_y:this._y} );
    _root.count++;
    trace(_root.count);
    } else {
    trace("unselected");
    selected = 0;
    _root.count--;
    trace(_root.count);
    but this code puts "smallmc" under "boxmc" :(( and 1 more
    problem ;
    i have 3x3 big boxes; and when i click a "boxmc" it puts 1
    smallmc then i click another "boxmc" it puts "smallmc" but previous
    one dissappearing.(but this is not prior problem i think first i
    should put small boxes in front of big ones)
    thank you for your all helps advices

    Not sure if this will help but: getNextHighestDepth() is not
    a standalone
    method - it is a method of a MovieClip. You need something
    like:
    this.getNextHighestDepth() instead.
    Dave -
    Adobe Community Expert
    www.blurredistinction.com
    http://www.adobe.com/communities/experts/

  • Buttons not working in movie clips

    I have multiple movie clips on stage (all in separate layers, of course) as well as buttons on stage to play each movie clip. There are buttons inside each movie clip. The problem is that the buttons inside the top layered movie clip work, but the others in the movie clips below don't.
    This is frustrating!! Can anyone help???

    It shouldn't matter which layer things are on.  If they are separate movielcips, one should not impact another.  What version of actionscript are you using?  Do any of the movieclips have mouse interactive code assigned to them?

  • Movie clips selecting current target

    Hi
    I am currently stuckon what i think has to be a simple
    problem:) the jist of it is as follows.
    I have a movie clip on stage that is clickable.
    Once clicked I creata new movie clip and attach a movie clip
    from the library.
    At this stage i also create a text field and add it as a
    child to the new movie clip.
    now my problem is that i want the movie clip to be clickable
    so that a user can maniuplate it. However if the click clicks on
    the text field i get an error saying it cant be converted to a
    movie clip. As yes i am casting the selcted object as a movie
    clip:) I just wondered if anyone could point me in the right
    direction of apporaching this, as its drivign me slowly insane.
    regards
    a

    Hi Kglad
    thats a very good question:) and im sure where img oign worng
    but cant work out how to do this:| Belwo is my code that creates
    the new clip once a icon has been clicked on stage.
    function addBubble(event:MouseEvent):void {
    bubbleNum ++; // increment bubble num to use as name of
    bubbles
    // add in bubble clip
    var bubbleClip:MovieClip;
    bubbleClip = new bubble_container()
    bubbleClip.name = "bubble" + bubbleNum;
    port.addChild(bubbleClip);
    // add in text field
    var myText = new TextField(); // initiate my text as
    textfield - CHANGED FROM DOING AS MOVIECLIP AS TEST
    myText.type = TextFieldType.INPUT;
    bubbleClip.addChild(myText); // add mytext to bubbleclip
    myText.text = "wahoo"; // CHANGED FROM >>> attach
    text field form library
    myText.autoSize = "left";
    myText.multiline = true;
    trace(bubbleClip.width);
    bubbleClip.x = 20;
    bubbleClip.y = 200;
    myText.x = 10;
    myText.y = 10;
    myText.width = 218; //bubbleClip.width; // THIS NEEDS
    WORK!!!!!!!!!
    trace("width of text=" + myText.width);
    bubbleClip.addEventListener(MouseEvent.MOUSE_DOWN,
    setSelect)
    steSelect does very little at the minute but it here its is
    for completion.
    function setSelect(event:MouseEvent):void{
    SelectedObject = MovieClip(event.target);
    All i really wnat to acheive is the following.
    user clicks an icon on the stage
    this creates a new bubble movie clip which houses a graphical
    asset(clip pulled from library) and a text field.
    sets up a listerner to see if this has been clicked. (i set
    the current target as selctedObject as there may be multiple
    bubbleClips)
    Once its been clicked it needs to be able to draggable and
    also scalable flippable etc(ive got the code on this working), a
    double click woud result int he text field inside being editable
    (havent got to this buit yet:))
    I jsuit cant get my head around casting and the best way to
    approach this, it works fine if the user clicks on the bbble
    graphic etc.Can u shine any light on this please?

  • Loading movie clip

    I am trying to load an external swf inside another movie clip
    yet, I am new to actrionscript and am not sure how to call the
    empty movie clip inside the other movie clip. I have:
    conradButton.onRelease = function() {
    framer_trail.trailer_mc.loadMovie("einstein.swf");
    Where the framer_trail is the movie clip on stage and the
    trailer_mc is the empty movie clip inside the framer_trail movie
    clip. Any idea how to do this? Thanks for any help!

    Can this be worked with through a global variable, or is
    there an easier way? I seem to be able to load a swf through a
    button if the empty movie clip is on the main timeline, but how
    would I access the empty movie clip if it is in another movie clip
    on the timeline?

  • Only one of the movie clips visible

    I have a few movie clips on stage. I want only one movie clip to be visible in each interval.  Please assist.

    same movieclip not selected twice in a row:
    var mcA:Array=[A,B,C,D,E];
    A._visible=false;
    B._visible=false;
    C._visible=false;
    D._visible=false;
    E._visible=false;
    clearInterval(vizI);
    vizI=setInterval(vizF,2000);
    vizF();
    function vizF(){
    if(prevMC){
    prevMC._visible=false;
    while(prevMC==nextMC){
    nextMC=mcA[Math.floor(Math.random()*mcA.length)];
    nextMC._visible=true;
    prevMC=nextMC;
    //be sure to execute clearInterval(vizI) before navigating away from this frame

  • Random location for a random movie clip

    I have various movie clips which I need to appear in one of
    four locations randomly. I need the movie clip to also be random. I
    also need more than one movie clip on stage at the same time. I
    believe the following needs to be used:
    Math.random
    duplicateMovieClip
    I also believ that the method needs to be generic. Apart from
    that I am stuck.
    Any help/ideas are appreciated.
    Hope my question makes sense?

    good point. to be honest thinking about it I dont really know
    why
    I have four movie clips, which the user controls called
    user1
    user2
    user3
    user4.
    In addition I have 6 additional movie clips which I need to
    appear and move (randomly) in one of four locations (based on a
    standard stage size):
    locations 1 (start position)
    x co-ordiantes 138.3
    y co-ordiantes 62.8
    locations 2 (start position)
    x co-ordiantes 549.3
    y co-ordiantes 53.8
    locations 3 (start position)
    x co-ordiantes 137.3
    y co-ordiantes 156.8
    locations 4 (start position)
    x co-ordiantes 543.3
    y co-ordiantes 147.8
    locations 1 (finish position)
    x co-ordiantes 291.3
    y co-ordiantes 162.8
    locations 2 (finish position)
    x co-ordiantes 397.3
    y co-ordiantes 162.8
    locations 3 (finish position)
    x co-ordiantes 280.3
    y co-ordiantes 257.8
    locations 4 (finish position)
    x co-ordiantes 400.3
    y co-ordiantes 258.9
    The maximum number of movie clips moving between the two
    positions at once should be 6. Ideally more than one from one
    location
    I would also like the speed at which they move to be
    different.
    The idea is that if a colission occurs between any one of the
    moving movie clips and the avatar(user 1-4) then points are added.
    Hope this helps.
    Thanks
    ******************

  • Why my movie clip disappears when it reaches to last frame?

    Hi,
    I have a movie clip on stage which length is 600 frames. I put a actionscript 3 code "stop();)" at the end of movie. it stops when it reaches to 600 frames but it disappears from the stage as well. Which I don't want. It should stop animating but stay with last fram which has a welcome message.
    How can I do this?

    I should remain visible, so you must be overstepping the last frame or the movieclip in some way.  Maybe the timeline your animation is in does not go as far as the timeline.

  • Dynamically adding multiple instances of a movie clip to the stage with one button

    hello,
    I was wondering if there was a way to add several instances
    of the same movie clip to the stage dynamically utilizing one
    button.
    I can do one with the following code placed on the button...
    on (release) {
    attachMovie ("filledCircle", "filled1", 5);
    filled1._x = 370;
    filled1._y = 225;
    But I want the user to be able to hit the button again and
    get yet another instance of "filledCircle" on the stage.
    I also want the user to be able to drag these instances
    around...
    Any help would be appreciated...
    Thanks,
    Muhl

    Muhl,
    > I was wondering if there was a way to add several
    > instances of the same movie clip to the stage
    > dynamically utilizing one button.
    Sure thing.
    > I can do one with the following code placed on the
    > button...
    >
    > on (release) {
    > attachMovie ("filledCircle", "filled1", 5);
    > filled1._x = 370;
    > filled1._y = 225;
    > }
    Gotcha.
    > But I want the user to be able to hit the button again
    > and get yet another instance of "filledCircle" on the
    > stage.
    You're in luck, because this isn't very hard to do. The main
    thing to
    keep in mind is that each instance must have A) its own
    unique instance name
    and B) its own unique depth. In your example, the instance
    name is filled1
    and the depth is 5. The next clip's instance name should be
    filled2 at a
    depth of 6. Then filled3, depth 7, and so on. You can use a
    single
    variable to handle the incrementation.
    // code in a frame
    var counter:Number = 1;
    // code on your button
    on (release) {
    attachMovie ("filledCircle", "filled" + counter, counter +
    4);
    With me so far? The variable counter contains the numeric
    value 1. The
    second parameter of attachMovie() is provided with a
    concatenation of
    "filled" + 1, which makes "filled1". The third parameter is
    provided with
    the sum of counter plus 4, which makes 5. Obviously, we need
    a bit more.
    The button must, in addition, increment the value of counter.
    The ++
    operator handles this perfectly.
    on (release) {
    attachMovie ("filledCircle", "filled" + counter, counter +
    4);
    counter++;
    Now, it seems you also want to position the attached movie
    clip to (370,
    225). Are they call supposed to go to the same place? If so,
    you may use a
    second variable to hold a reference to the newly attached
    clip. Look up
    MovieClip.attachMovie(), and you'll see that the method
    returns the exact
    reference you need.
    // code in a frame
    var counter:Number = 1;
    var mc:MovieClip;
    // code on your button
    on (release) {
    mc = attachMovie ("filledCircle", "filled" + counter,
    counter + 4);
    counter++;
    mc._x = 370;
    mc._y = 225;
    Make sense?
    > I also want the user to be able to drag these instances
    > around...
    Then you need to handle a few events. You're dealing with
    movie clips
    here, so your best bet is to study up on the MovieClip class,
    which defines
    all movie clips. (Note, also, that the TextField class
    defines all input
    and dynamic text fields; the Sound class defines all sounds,
    etc. This is a
    very handy arrangement of the ActionScript 2.0 Language
    Reference.)
    // code in a frame
    var counter:Number = 1;
    var mc:MovieClip;
    // code on your button
    on (release) {
    mc = attachMovie ("filledCircle", "filled" + counter,
    counter + 4);
    counter++;
    mc._x = 370;
    mc._y = 225;
    mc.onPress = function() {
    this.startDrag();
    mc.onRelease = function() {
    this.stopDrag();
    Easy as that. You're simply assigning a function literal to
    the event
    of each new MovieClip instance as you create it. Take a look
    and you'll see
    each of these class members available to you -- that is, to
    all movie clips.
    MovieClip.onPress, MovieClip.startDrag(), MovieClip._x, etc.
    Wherever it shows the term MovieClip in the Language
    Reference, just
    replace that with the instance name of your clip -- or a
    reference to that
    clip (which even includes the global "this" property).
    David
    stiller (at) quip (dot) net
    Dev essays:
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • How do i make an image pause in a flash movie clip

    Please can someone help me. I am trying to find out how to pause or stop an image in a basic flash movie clip,  after it has entered from one side and before it exits the other side.
    I have been trying to work it out myself for three days but no joy. I am practicing  for a test with a training agency which gave me a disk to use but nowhere in it does it say how this is done. I am also having a lot of difficulty making stop start buttons work with this movie clip. I am using a trial cs5.5 version of Flash which expires in 7 days so i need to know this soon. I am up to speed on most of the features, its just this one thing that has me stumped. A lot of the tutorials or examples  i have found on the net are very long winded and hard to follow exactly. Could someone let me know, step by step the sequence i should follow after i have created an object  and made it go from one side of the stage to the other.

    Hi
    Thank you for getting back to me. Yes i am using a timeline tween. I have an image on my stage which moves in from one side and out the other side. I am trying to stop or pause the image. The effect i will be asked to reproduce in my exam will be something very much like the banner on the website http://www,iactweb.com. If you go to this website you will see images arrive on the banner and pause before exiting the other side. I am fairly up to speed on all the aspects of getting this effect but i have forgotten what i learned during the course on how stop or pause the images. I am using the trial cs5.5 version of flash . Thanks again for getting back to me.

  • How do I assign a mouseclick event Listener to a simplebutton already nested in a movie clip when it's dropped on stage?

    I'm trying to assign a mouseclick event listener to a simplebutton nested within a movie clip's later frames, starting at frame 2 and up. This card, however, is not added to my game until later, and when the player clicks on it/turns it over.
    There are four files involved in this program:
    #1 The main actionscript file, which corresponds to
    #2 my dreamQuester .fla file.
    #3 my artifactCard file movieClip's corresponding .as file,
    #4 my combo1.as file corresponding to a an instance of a simpleButton named combo1 that is already
    nested --and this instance is already named-- inside/as a child of said artifactCard movieclip.
    What I've done so far isn't working:
    In my main dreamQuester.as file, when a player clicks on an artifactCard, its MOUSE_DOWN event
    listener takes them to this function (clickArtCard), where the trouble is at:
    // player clicked on the artC card--which is a child of posArt1 on stage--to turn card over:
            function clickArtCard(a_event:MouseEvent) {
                var thisArtCard:artifactCard = (a_event.target as artifactCard);
                thisArtCard.gotoAndStop(unclickedArt1);  // go to frame number of artifact
                                    // card where combo1 button is.
                thisArtCard.removeEventListener(MouseEvent.CLICK,clickArtCard);
                thisArtCard.buttonMode = false;
                trace("combo1.combo is:" + combo1.combo);
                trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1);
                posArt1.artC.combo1.addEventListener(MouseEvent.MOUSE_DOWN, comboClickedWHO);
    when the artC card--the static public instance of artifactCard--is clicked, it only gets to the
    trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1); which returns this error message:  
    TypeError: Error #1010: A term is undefined and has no properties.
        at MethodInfo-61()
    So do how would I declare a static public variable of this simpleButton at the start of my main .as
    file to make it defined to get a mouseDown actionListener into my pre-existing-and-named-instance
    combo1 simpleButton?
    perhaps there is a way, while the debug movie program is running, to click on the simpleButton and see exactly
    what it's parent heirarchy is, to see the name of all parents above the simpleButton incase they are
    different then what I think?
    (just in case, I was hoping to squeeze a zip file containing these files to be less than 9MB incase someone was willing to look at my files to see what I've done so far, but 9 megs is just too big! even though all graphics I've imported where turned into vector graphics with trace bitmap. I wish there was a way to check the file size of each symbol in Flash CS4, here...)
    Thank you so much for any help!
    ~Ethan

    Just use a
    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
    function keyPressed(event:KeyboardEvent):void {
         //trace(event.keyCode);
         if(event.keyCode == ???){
              // play the sound
    Where I show the "???" you would replace with the keyCode for the key you want pressed for that sound.  To determine the keyCode you can use the trace line that I have commented out.
    Note that when testing in Flash you often need to disable the keyboard shortcuts in the Flash Player in order to be able to use alot of the keys.  You will find this option in the Control menu options in the player.

  • Error 1034: Converting movie clip to instance of a custom object?

    I have several movie clips on the stage that each have unique instance names.
    I need to instantiate them as instances of a custom class I have created. This is giving me an error, and I know I'm probably missing some simple concept somewhere, doing something wrong, but I don't know what it is.
    Here is my code:
    In the main timeline, I have (simplified):
    var puzzleAL:GeoGroup = new GeoGroup ("AL", "Alabama", 1, false);
    puzzleAL.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
    function geoTouchBeginHandler (e:TouchEvent): void {
        e.target.gotoAndStop("Over");
        nameDisplay.gotoAndStop(e.target.abbrev);
        e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
    function geoTouchEndHandler (e:TouchEvent): void {
        if (e.target.lock == false) {
            e.target.gotoAndStop("Off");
        else if (e.target.lock == true) {
            e.target.gotoAndStop("Lock");
        nameDisplay.gotoAndStop("USA");
        e.target.removeEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
    It throws an error before the object is ever instantiated. It compiles, but at runtime I get:
    TypeError: Error #1034: Type Coercion failed: cannot convert Puzzleography_fla::Alaska_2@da0a0f9 to GeoGroup.
         at flash.display::MovieClip/gotoAndStop()
         at Puzzleography_fla::MainTimeline/goToFrame()
    My class code looks like this, if it matters:
    package  {
        import flash.display.MovieClip;
        public class GeoGroup extends MovieClip {
            public var abbrev:String;
            public var fullName:String;
            public var assignedOrder:Number;
            public var lock:Boolean;
            public function GeoGroup(abbrev:String, fullName:String, assignedOrder:Number, lock:Boolean) {
                this.abbrev = abbrev;
                this.fullName = fullName;
                this.assignedOrder = assignedOrder;
                this.lock = lock;
    I'm missing something obvious, I know it, but I'm new to OOP, switching from procedural, so I'm sure I'm getting a concept wrong somewhere.
    Thanks so much!
    Amber

    yes, it makes sense and yes, you'll need to learn a little.
    I have 50 movie clips not linked to any actionscript in the movie.
    that's incorrect.  those movieclips are linked to all the actionscript that applies to their class.  so, even if those movieclips weren't part of the GeoClass, they still have all the properties, methods and events of the movieclip class (created by adobe developers).
    The fact these movieclips are actually GeoGroup objects extending the movieclip class, adds even more code to them.  and, so far that's all good and exactly what you should do.
    They are all on the stage. They are all named with their instance names "puzzleAZ" "puzzleTX" etc.
    no problem, usually.  (but in your case, a problem explained below.)
    I want to be able to add variables to them, such as strings and numbers, so that I can call puzzleAZ.size or puzzleAZ.fullName to get "XX Acres" or "Arizona" returned.
    so, in programming lingo you want your objects to be members of a dynamic (ie, you can add properties) class.  the movieclip class is just such a class.
    I created a separate class (GeoGroup) that extends MovieClip that has in it all the variables I need and tried to assign each movie clip to that class.
    here's the problem.  when you created your GeoGroup class you mandated that certain parameters be passed to the constructor.  when you add a class member (like each of those puzzle pieces) to the stage, the class constructor is invoked (along with everything else in that class).  However, no parameters are passed to your constructor so the flash compiler points out the issue and refuses to run your code.
    there are two ways you could proceed:
    1.  remove the parameters from the constructor
    2.  don't add any class members to the stage in the authoring environment.
    p.s.  this is your GeoGroup constructor:
          public function GeoGroup(abbrev:String, fullName:String, assignedOrder:Number, lock:Boolean) {
                this.abbrev = abbrev;
                this.fullName = fullName;
                this.assignedOrder = assignedOrder;
                this.lock = lock;
    the paramters that contructor requires are 2 strings, one number and one boolean.

Maybe you are looking for