I have a series of animations. When one finished the next one starts and so on. They are a mix of frame and actionscript tweens(this means TweenEvent listeners are not an option for them all).
At first I was triggering event dispachers but this got messy due to the number of animations and having to think up loads of names for the dispatchers.
Then I tried this
stage.addEventListener(Event.ENTER_FRAME, getFrame);
stage.addEventListener(Event.ENTER_FRAME, getWavesFrame)
function getFrame(event:Event) {
if (whiteBox_mc.currentFrame == 20) {
waves_mc.gotoAndPlay(2);
stage.removeEventListener(Event.ENTER_FRAME, getFrame);
}
}
function getWavesFrame(event:Event) {
if (waves_mc.currentFrame == 20) {
ukMap_mc.alpha = 1;
var mapTween:Tween = new Tween(ukMap_mc, "alpha", None.easeIn, 0, 1, 0.8, true);
stage.removeEventListener(Event.ENTER_FRAME, getWavesFrame);
}
This worked well but got me thinking…is there a more efficient AS3 way? Built in functions to dermine what frame an animation is on. Also is using ENTER_FRAME not causing uneccessary CPU usage?
Any alternative ways or suggestions would be apprectiated.