First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: edmarriner | Website: http://www.edmarriner.co.uk
Variables What YOU need to know Part 1 If you are serious about making games in flash you NEED to know about variables. Variables have been use in almost every great game there has ever been! There used for things like money , lives , objects and LOADS more things to. So hopefully by the time you’ve read this tutorial you will know the basic’s of variables ! ------------------------ So in the first tutorial (this one) were going to make a money system ! (note: im working in flash mx 2004 pro , although this should work also with flash 5 , mx , mx 2004) Ok , so open up flash if you haven’t all ready. Make a new normal flash file. In the first key frame add this actionscript ; Money = 1000 This tells flash to set the Variable “money” which you just created to 1000. a Variable can be called anything and can hold letters and numbers . In this case its holing numbers. Now make a second layer and call it text . Then rename the other layer to shop. Click on frame 1 of layer text and make a dynamic textbox. On the text boxes properties were it says “ var: “ in the text box to the right type in money. This tells flash to show what ever the Variable money is holding in that text box. If you test the movie now the text box should say “1000”. Now make a button on the layer shop . Give the button this actionscript: on (release) { money -= 10; } Now test the movie again. When you press the button your money gos down 10 each time. You can also use thisaction script on the button; on (release) { money += 10; } This adds 10 to your money ! So how could you this what you have just learnt? Here just two ways; 1) make a shop 2) when you work at a shop you get paid i hop this was helpful and clear. ANY problems just email me at ed@edmarriner.co.uk Thanks ed
» Level Intermediate

Added: 2005-01-03
Rating: 6.98 Votes: 44
(10 being the highest)
» Author
im 12 , live in england :)
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • Mr.

    Posted by Brian on 08/13/2012 10:53am

    Hey, man, this was pretty good, taught me a lot. I'm curious, though, how do you keep the "money" counter from going below zero?

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.