# Better than ENTER\_FRAME for this project?

**URL:** <https://forum.kirupa.com/t/better-than-enter-frame-for-this-project/266728>\
**Category:** flash\
**Created:** [July 23, 2008, 9:07pm UTC](https://forum.kirupa.com/t/better-than-enter-frame-for-this-project/266728 "2008-07-23T21:07:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpann](https://avatars.discourse-cdn.com/v4/letter/t/c67d28/32.png) [@tpann](https://forum.kirupa.com/u/tpann)\
**Post date:** [July 23, 2008, 9:07pm UTC](https://forum.kirupa.com/t/better-than-enter-frame-for-this-project/266728/1 "2008-07-23T21:07:38Z")

</div>

I’m not a developer and over the course of the past year during which I’ve learned a lot of AS3, I have probably not come close to applying what would be considered “best practices.” I have lots of code that could probably be dramatically changed to improve performance.

Here’s a bit of my code that I’d like advice about. Is there a different technique I can use to do the following, that’s more streamlined?

masterCounter is variable that’s iterated every tenth of a second on the root timeline. The following code is in a movie clip that’s been added to the stage:

```php

addEventListener(Event.ENTER_FRAME, s003Listener);
function s003Listener(event:Event):void {
 if (!event.target.parent.masterIsPlaying) {
  pauseAudio();
 }
 if (event.target.parent.masterIsPlaying) {
  resumeAudio();
 }
 if (event.target.parent.masterCounter == 1) {
  startAudioBkgd();
 }
 if (event.target.parent.masterCounter == 10) {
  startAudio01();
 }
 if (event.target.parent.masterCounter == 50) {
  Tweener.addTween(s003Presented, {alpha:1, time:fade});
 }
 if (event.target.parent.masterCounter == 62) {
  playWhoosh();
 }
 if (event.target.parent.masterCounter == 65) {
  s003Presented.gotoAndPlay(2);
 }
 if (event.target.parent.masterCounter == 95) {
  Tweener.addTween(s003Presented, {alpha:0, time:fade});
  Tweener.addTween(s003title, {alpha:0, time:fade});
 }
// ...etc. Imagine there are a hundred of these if statements...

```

Don’t flame me for being a Flash Butcher!

Thanks for any help!
