-
Flash Movie Frame
I have a flash file with an animation going across 89 frames, that animation goes with a movie clip that is on top of it for 30 of those frames. The movie clip has 3 frames but has a stop action on each. I want to the main animation to loop through once on frame 1 then loop through again but have the movie clip on frame 2. I have it coded like this but it isn't working.
Code:
Frame 1:
var count_loop = 2;
Frame 2:
trace(count_loop);
//trace is to verify count_loop is functioning correctly which it is
_root.sign1.gotoAndStop(count_loop);
// this doesn't appear to be being called
Frame 89:
total_frames = 3;
if (count_loop>=total_frames) {
count_loop = 0;
}
count_loop = count_loop+1;
gotoAndPlay(2);
This is in CS3, AS2, for Flash Player 8. Thanks for any ideas.
-
Okay, so you have an MC with 3 frames. You have an 89 frame animation. You want the animation to run through all 89 frames while the MC is on frame 1, then start all over and loop through all 89 frames while the MC is on frame 2, then all over again while the MC is on frame 3?
Is that correct?
-
-
Is it possible to put that 89 frame animation in an MC of it's own? It would be a very simple fix if you could do that.
If you can, let me know and I will spit out the code for you, if not I will have to rethink it.
-
Yea I could put the animation into a movie clip of its own.
-
Perfect. Do that and then you will want to add this code to accomplish what you want.
Note, this is off the top of my head, so it may need a tad bit of adjusting...
Code:
//Below "MC" refers to the 3 frame MC
// and "anime" refers to the 89 frame animation...
stop();
this._parent.MC.nextFrame();
if (this._parent.MC._currentframe<=3) {
this.gotoAndPlay(1);
} else {
this.stop();
this._parent.MC.gotoAndStop(4);
}
Okay, all of this code goes on frame 89 of the animation MC. Be sure to give each MC an instance name. That should do it.