# Is there a "when" in programming as oppose to if/else if etc?

**URL:** <https://forum.kirupa.com/t/is-there-a-when-in-programming-as-oppose-to-if-else-if-etc/324876>\
**Category:** Uncategorized\
**Created:** [September 13, 2011, 6:00am UTC](https://forum.kirupa.com/t/is-there-a-when-in-programming-as-oppose-to-if-else-if-etc/324876 "2011-09-13T06:00:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![somdow](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@somdow](https://forum.kirupa.com/u/somdow)\
**Post date:** [September 13, 2011, 6:00am UTC](https://forum.kirupa.com/t/is-there-a-when-in-programming-as-oppose-to-if-else-if-etc/324876/1 "2011-09-13T06:00:47Z")

</div>

what i mean is, is there a way in AS3, or in programming in general(php, js etc) to make an event fire/activate “WHEN” something does something, as oppose to an if/else if / else statements ?

for example, say i want to make an event fire /activate \*\*\*ONLY \*\*\*\*\*\*when \*\*\*a frame label is hit, and thereafter , do something else etc, essentially making it do things one by one down the line according to \*\*\*WHEN \*\*\*certain objectives are met. is there a “when” type of statement etc that will do this as oppose to if/else if etc???

for example, using the above example, instead of me doing something like this:

```auto
xyz.addEventListener(Event.ENTER_FRAME / or INIT , btn);

function btn(e:Event):void{
    ***if*** ( externalSwf.currentFrameLabel == " label here "){
          do something code here.
    }

}

```

is there a way to do it like this:

```auto
xyz.addEventListener(Event.ENTER_FRAME / or INIT , btn);

function btn(e:Event):void{
    ***when*** ( externalSwf.currentFrameLabel == " label here "){
          do this.
       

          when (this happens){ 
        do this next
}
    }

}

```

etc…

how can one accomplish that?

reason i ask is because i have a little project im working on (smooth transitions of external swfs code) that is partly working but i cant for the life of me, figure out how to implement a structure like what i have directly above.

hope its not confusing.

any tips ideas etc i gladly appreciate.

thank you.
