How to use onClipEvent(mouseUp) and onClipEvent(mouseDown) - Page 3
The mouseDown confirms that a valid click was made on the penguin, it starts playing the timer animation, advances the penguin clip one frame, and sets the counter flag to "startcount".
An enterframe clip events is always checking the status of the counter flag. If it is set to "startcount", then it knows to start incrementing the counter. If it gets up to the maximum (in this case 15), then it stops incrementing.
On MouseUp, the counter is set to "start" which means do the jump. It sets a value of volume which is passed into the sound generator function (a function to dynamically generate a sound effect).
The enterframe clip has a clause for the counter being set to "start", and the penguin is animated based on the velocity set by the number of times the enterframe clip event ran before between the mouseDown and mouseUp events.
So as you can see it is all pretty straight forward. Download the source to have a look at the code in action. If you want o see more tutorials like this one, check out www.ur.co.nz and go to the tutorials section
|» Level Intermediate|
Rating: 7.53 Votes: 45
|No details available.|
|Download the files used in this tutorial.|
|Download (55 kb)|
|More help? Search our boards for quick answers!|