# Best way to trigger

**URL:** <https://forum.kirupa.com/t/best-way-to-trigger/260530>\
**Category:** Uncategorized\
**Created:** [May 16, 2008, 2:57pm UTC](https://forum.kirupa.com/t/best-way-to-trigger/260530 "2008-05-16T14:57:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alber\_Kidd](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Alber\_Kidd](https://forum.kirupa.com/u/Alber_Kidd)\
**Post date:** [May 16, 2008, 2:57pm UTC](https://forum.kirupa.com/t/best-way-to-trigger/260530/1 "2008-05-16T14:57:25Z")

</div>

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.
