dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: nextFrame(); after animation

  1. #1
    Junior Member
    Join Date
    Nov 2003
    Posts
    5

    nextFrame(); after animation

    I have a very simple animation (object falls from off screen and lands with a bounce) and I simply want to go to the next frame when the animation has finished. Any straight forward way of doing this?

    Ta.

  2. #2
    Spidey wants his icon back! Defyeler's Avatar
    Join Date
    Jul 2002
    Location
    New York City
    Posts
    255
    At the end of your animation just add the following.

    _root.gotoAndPlay ("frame_label"); // goes to a frame on the main timeline.

    or

    _root.gotoAndPlay.nextFrame(); // goes directly to the very next frame of main timeline

    or

    _root.OtherMC.gotoAndPlay ("frame_label"); // plays a frame of an MC on the main timeline.

    or

    you can insert this into your main timeline to detect when a certain movieclip is done playing.

    if (_root.Animation._currentframe == "End Frame") {
    _root.gotoAndPlay("frame_label");
    } else {
    stop();
    }

    Then add a frame label to the last frame of your animation movie clip.

    The latter is easier to use, as you can just alter the script for many movie clips.
    Last edited by Defyeler; 11-28-2003 at 06:44 AM.
    Its never.. wow kool I like it, its always.. ok I made this.. how can it be better?

  3. #3
    Junior Member
    Join Date
    Nov 2003
    Posts
    5
    Sorry I didn't exlpain myself very well. I need to actually detect when the animation has stoped as the code is in an onEnterFrame type function.

    Thanks for your effort though!

  4. #4
    Spidey wants his icon back! Defyeler's Avatar
    Join Date
    Jul 2002
    Location
    New York City
    Posts
    255
    if (_root.Animation._currentframe == "End Frame") {
    _root.gotoAndPlay("frame_label");
    } else {
    stop();
    }

    This does that.. For example..
    Frame 1
    onEnterFrame = function () {
    _root.AnimationMC.play();
    }
    Frame 2
    if (_root.AnimationMC._currentframe == "end") {
    _root.gotoAndPlay("frame_label");
    }
    else {
    play();
    }
    Frame 3
    _root.gotoAndPlay.prevFrame();

    THis tells it, to run an animation, to check which frame the animation is on, if the animation is on the last frame that you labeled "end". It will play the next frame.
    Last edited by Defyeler; 11-28-2003 at 06:56 AM.
    Its never.. wow kool I like it, its always.. ok I made this.. how can it be better?

  5. #5
    Junior Member
    Join Date
    Nov 2003
    Posts
    5
    Thank you. I think this may do the trick!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center