Control a Timeline with Mouse Position
Clean Up The ActionScript
Ok, let's start to clean up the ActionScript, starting with that trace(); function. If you're like me, you are slightly annoyed when the Output window pops up every time you test your movie. So, select that line of code and Delete it:
Now rearrange the rest of the code so it's in a more "acceptable" order.
- First, we like to declare variables at the very start of the script
- Then we call the init function (Really! Call it before you define it, as strange as that seems)
- Next we define the init function
- Finally, run the onEnterFrame loop