Our tutorials have been submitted by our own members and staff over the last four years. They cover a range of design packages and programming languages.
Tutorials are key part of learning new skills, so we not only recommend that you try some, we suggest you experiment with the framework that they give you, don't be scared to wander from the instructions.
Click the categories below to get started!
Alternatively you can pass on your useful tips and advice to others, by creating your own.
Submit a Tutorial
If you like a tutorial, please use the "digg" button below it.
A variable is a little bit of memory, it'll hold a value defined to it. They're used for accessing later, so you can work with its information. AS1.0 and AS2.0 work with variables in the same fashion, except for one major difference. I'll be sure to point that out later. To create a variable, you'll use the following syntax:
var myString = "Hey";
Notice the "var"? That's announcing the variable. The word following it is the variable name. In the above case, I assigned the value "Hey" to the variable. The ending semi-colon announces the end of the line (The semi-colon is required).
AS2.0 Only:
Variables in AS2.0 have one extra feature. Datatype definition.
var myString:String = "Hey";
Notice the ":String"? That's the Datatype. When you go to type the above in, after inputting the colon, a list will drop with all the Datatypes. Look through it sometime.
Alright, now that you know how to assign variables, I'll introduce you to a method commonly used in Flash. The trace() method.
var myString = "Hello, this is a variable"; trace("The variable's value: " + myString);
Put that into Flash's Action's panel, and press "Ctrl + Enter". You'll notice the output box. That is caused by the trace() method, as it is used to display data. If you haven't already guessed, the value to by outputted is defined inside the parenthesis.
Also, the "+" Operater can be used to combine to entities. In this case, a String and a variable. So, you now know how to create variables and output them. As you continue with Flash, you'll find more and more used for them, this was just a quick intro :)
The music doesnt start automaticly. Find a short but simple loopable .wav file. .wav is recommended but you can use .MP3 or Newgrounds are great places to find music Open flash (obviously)
Make 3 Keyframes if you are going to put a small preloader useless)
Make 2 keyframes if you wont use a preloader
In frame 2 (It's Frame 1 for those that didnt included a preloader.)
Make a button that says PLAY Right click on frame 2 (It's Frame 1 for those that didnt included a preloader.) and select ACTION in the action window, put this exact code:
stop();
Now right click on frame 3 (It's Frame 2 for those that didnt included a preloader.) and select ACTION again Put this exact BIG chunk of code
stop(); if(_global.Behaviors == null)_global.Behaviors = {}; if(_global.Behaviors.Sound == null)_global.Behaviors.Sound = {}; if(typeof this.createEmptyMovieClip == 'undefined'){ this._parent.createEmptyMovieClip('BS_music',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) ); _global.Behaviors.Sound.music = new Sound(this._parent.BS_music); } else { this.createEmptyMovieClip('_music_',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) ); _global.Behaviors.Sound.music = new Sound(this.BS_music); } _global.Behaviors.Sound.music.attachSound(\"music\"); if (true) { _global.Behaviors.Sound.music.start(0,50); }
Were it say
.Sound.music.start(0,50);
50 is the number of time the music will loop In the same frame, put a button that say STOP
Now right-click on the new STOP button and choose ACTION Put that exact code in:
on (release) { gotoAndStop(2); _global.Behaviors.Sound.music.stop(); }
Do the same for the PLAY button but this time, put this code in:
on (release) { nextFrame(); }
still there? ok, now the easy part Import your song file-import Go in the Library and right click on your song, select LINKAGE check EXPORT FOR ACTIONSCRIPT you should have 2 checkbox checked In the IDENTIFIER field, type music Thats all! press ok, test your button and it should work fine!