# Could someone (ideally senocular) help me simplify this code

**URL:** <https://forum.kirupa.com/t/could-someone-ideally-senocular-help-me-simplify-this-code/102150>\
**Category:** Uncategorized\
**Created:** [February 20, 2004, 5:32am UTC](https://forum.kirupa.com/t/could-someone-ideally-senocular-help-me-simplify-this-code/102150 "2004-02-20T05:32:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gragland](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gragland/32/422_2.png) [@gragland](https://forum.kirupa.com/u/gragland)\
**Post date:** [February 20, 2004, 5:32am UTC](https://forum.kirupa.com/t/could-someone-ideally-senocular-help-me-simplify-this-code/102150/1 "2004-02-20T05:32:13Z")

</div>

I modified senocular’s waitbuttonanimations fla which is basically 3 mbuttons that each play an mc. But when a button is pressed it waits untill the previous buttons mc plays its out animation before it plays its in animation.

Anyway, i modified this so that instead of an animation tween it does an alpha fade. Here it is: [www.s91931107.onlinehome.us/wait%20buttons2.swf](http://www.s91931107.onlinehome.us/wait%20buttons2.swf).

The only problem is that i used 3 onEnterFrame events that are constantly playing even when they are not needed. If someone could take a look at my fla (it should’nt take long to see how it works) and see if they can come up with a more efficient way then that would be great. Thanks!

HERES THE FLA: [www.s91931107.onlinehome.us/wait%20buttons2.fla](http://www.s91931107.onlinehome.us/wait%20buttons2.fla).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 5:34am UTC](https://forum.kirupa.com/t/could-someone-ideally-senocular-help-me-simplify-this-code/102150/2 "2004-02-20T05:34:04Z")

</div>

on the enterframe use an if statement like if u did a fade out include this

if(this.\_alpha\>100){  
delete this.onEnterFrame  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 5:36am UTC](https://forum.kirupa.com/t/could-someone-ideally-senocular-help-me-simplify-this-code/102150/3 "2004-02-20T05:36:20Z")

</div>

> \*Originally posted by flash4food \*  
> \*\*on the enterframe use an if statement like if u did a fade out include this

if(this.\_alpha\>100){  
delete this.onEnterFrame  
} \*\*

But then what if i need the onEnterFrame event to start up again (like if the user clicks the button again.)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 20, 2004, 4:59pm UTC](https://forum.kirupa.com/t/could-someone-ideally-senocular-help-me-simplify-this-code/102150/4 "2004-02-20T16:59:19Z")

</div>

anyone?
