Okay, so I have a looping animation that is several frames long. Inside the animation is a button, when pressed I want to go to another part of the timeline, where another animation is waiting. Simple, I got that working no problem.
But… I need the first animation to go to the last frame in the loop before starting the next animation. The way I have it now makes an ugly cut, and the transition between animations isn’t seamless.
Here’s my actionscript… I kinda had an idea of what to do and then I got stuck. I think this would be telling it that if it were on the last frame of the loop, to go to the next animation. What I want is the button command to be acknowledged, but if it isn’t on the last frame then let the animation play through until it gets there, then switch animations.
Why don’t u do it the other way round?:
action on the button:
on(press) {
_root.pressed = true;
}
action on the last frame of your loop:
if(_root.pressed){
gotoAndPlay(“CharacterStop”);
}
action on “CharacterStop”:
_root.pressed = false;
The [font=courier new]MovieClip._currentframe[/font] property returns the frame number, it will never return the frame label.
However, if you need to compare it against a frame label, something like this should work:
// method
MovieClip.prototype.currentFrameIs = function(frame) {
var cf = this._currentframe;
this.gotoAndStop(frame);
var ef = this._currentframe;
this.gotoAndStop(cf);
return cf == ef;
};
// usage
my_mc.currentFrameIs("frame_number_or_frame_label");
This method returns [font=courier new]true[/font] if the current frame is equal to the frame number or label specified by the parameter frame, returns [font=courier new]false[/font] otherwise.
… What a nice useless reply since your problem has been solved already.