Sunday 12 June 2011

Flash 8

Sorry everyone who wants to learn Flash CS5 I am learning it but im not too good at it. I have been learning Flash 8 for 2 years now and I’ve learned lots. If  you need help and have a question feel free to post it in the comments section. It is a simple programming language but very powerful. If you need great help and are a beginner I would recommend “Actionscript Animation: Making things move!” In Flash Actionscript 2. If you want to learn more animation than code use “How to use Flash MX.” Flash MX is near Flash and the coding is basically the same. The setup is a little different. So on to the code…
The main frame has a basic setup and is very easy to use from the start. The timeline is at the top and that is what contains all the frames in your animation. In the center of the screen there is the stage. That contains everything you want to play. The stage can include text, buttons, movieclips, sounds, and even movies. On the right is where all the colour editing tools go and your library too. At the bottom is where your code and object properties go. On the left is where your tools go. And the file menu is at the top. Feel free to move anything around.
To start off in flash the first thing you will usually add code wise is “stop();” which ends the animation until you tell it to continue. So you can make an animation then put in “stop();” And your animation will stop. Stop is a very powerful command code wise and animation wise. It is used in almost every code snippet on the main frame.
The next part of your code will probably be setting up the variables. There are a few ways to setup variables. The easiest way is pretty straightforward and it “example = 10;”. You could also use “var example = 10;”. The second is just using “var” before which tells the computer that it’s a variable. The longest way is to use “var example:number =  10;”. The longest way tells the computer that it’s a variable and adds in a property telling what type; In the example I gave a number. There are other properties like string which is a group of letters put together.
The third part of code you will use will probably be something telling the computer what to do on each frame. The code to repeatedly check and enter code is “onEnterFrame = function(){“.  There are  many ways to enter it. For example. You could type “function onEnterFrame(){“, or “onEnterFrame = function(void){“. The second way has more options available in your code and the third is only used for special snippets of code. My favourite is the first way. Everytime you have “{“ you must put a “}” after to say that your ending that part of code.
The next code you add will usually be anything that happens inside the EnterFrame code. It could be an if statement telling what to do if something happens which is written “if(thisHappens){“ then do this: and after you do an if statement you must end it with a “}” of course. You could also want to add to a variable which is written “number += 1” or “var number += 1” or you could even subtract with “-“. You could tell a movieclip to move by typing something like “movieclip._x += 1” or “movieclip._y -= 1”. You can’t tell a movieclip to change its Z position though.
·       All examples want you to remove “” from the code.
·       Below is an example of code using everything taught above:
stop();
var example = 10
onEnterFrame = function(){
              var example += 1
              if( example > 15){
              var example:number = 0
              }
}
The above code tells the animation to stop. Then it says there is a variable equal to ten. Then it says to repeat everything below the onEnterFrame. It says the variable example has to add one. It says if example is greater than fifteen then var example equals zero. Then it says to end the if statement. And finally end the onEnterFrame statement so everything below that won’t  repeat.

No comments:

Post a Comment