Search tutorials
Next, draw a square, highlight it and convert it to a symbol (F8) or Insert- Symbol. In this tutorial It doesn't matter what its called. Press OK. Now, select your rectangle and give it the following script:
onClipEvent (enterFrame) {
if (_root.rollingscore<_root.score) {
_root.rollingscore += 1;
}
}
on (press) {
_root.score+=10
}
If your new to flash, I'll explain this in the wonderful language we like to call English. If your intermediate / advanced and you think I'm insulting your intelligence, you shouldnt be viewing this tutorial..
Anyway
onClipEvent(enterFrame) {
is like Once upon a time. You need it to start a story, or else it wouldnt work. E.g. Once upon a time the mad man came out with a yellow bananna and took the hamster hostage. Without the Once upon a time, it wouldnt make sense.
Depending on your Frame rate, e.g. 12 (standard) it will mean that what you want to happen will happen 12 times every second.
if (_root.rollingscore<_root.score) {
Means if the number rolling score is smaller (remember kids, the crocodile always eats the larger number) (< means smaller than, > means larger than)
Umm, lets start again
Means if the number called rolling score is smaller than the number score...
_root.rollingscore+=1the number called rollingscore will increase by 1. The last part says
on (press) {
when you press the button...
_root.score+=10The number score will increase by 10 - Easy! That's the tutorial Done. If you have any questions / comments, blah blah blah, you know the address, CorkySurprise@AOL.com
Wait! Q: What if my button added an extra thousand to the score, It would be there for Months... A: Erm, change _root.score+=1 to _root.score+=10 or something...Depends On your needs Mike
| » Level Basic |
|
Added: 2005-08-18 Rating: 5 Votes: 17 |
| » Author |
| Boring |
| » Download |
| Download the files used in this tutorial. |
| Download (0 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


Comments
There are no comments yet. Be the first to comment!