Your Very First Flash Movie
For his birthday, I sent my nephew Matthew a copy of Flash 8. I've been meaning for some time to write up a tutorial on how to write some simple programs using this. So here goes, from the ground up.
Matthew, I'm using a Macintosh computer, but I'm certain that the Windows version I got for you works the same way. But that might be why the screenshots look a little different for you.
First Install Flash.
Next, run Flash 8. You should get this window, in which you should click on new "Flash Document"

This part is a tiny bit tricky: Click on the very first rectangle in the timeline near the top. It is right below the number "1" and to the right of "Layer 1":

Now choose "Actions" from the "Window" menu.

This will reveal the actions palette. Click inside this window and type this:

Now save the flash movie. Choose "Save" from the "File" menu -- or just press Control-S. Create a new directory called "experiment1" and save the file there, with a name "experiment1.fla".


Next, we'll create a new Actionscript File. Choose "New" from the "File" menu, to show this dialog:

Now save this file (File -> New, or Control-S).

Click inside the myScript.as window and type this code:

After typing in the code, click the tab to show "experiment1.fla". Then choose "Test Movie" from the "Control" Menu:

This is what you should see:
Once you get this far you can close the test window and start playing around the the computer program. Click the tab to go back to myScript.as and try some experiments. After each try, remember click the "experiment1.fla" tab and choose "Test Movie" again.
Here is what I did with my drawing. I used a "for" loop -- something I hope I'll have time to tell you about later!
Matthew, I'm using a Macintosh computer, but I'm certain that the Windows version I got for you works the same way. But that might be why the screenshots look a little different for you.
First Install Flash.
Next, run Flash 8. You should get this window, in which you should click on new "Flash Document"

This part is a tiny bit tricky: Click on the very first rectangle in the timeline near the top. It is right below the number "1" and to the right of "Layer 1":

Now choose "Actions" from the "Window" menu.

This will reveal the actions palette. Click inside this window and type this:
#include "myScript.as"

Now save the flash movie. Choose "Save" from the "File" menu -- or just press Control-S. Create a new directory called "experiment1" and save the file there, with a name "experiment1.fla".


Next, we'll create a new Actionscript File. Choose "New" from the "File" menu, to show this dialog:

Now save this file (File -> New, or Control-S).

Click inside the myScript.as window and type this code:
var clip1:MovieClip = _root.createEmptyMovieClip( "clip1", 1 )
clip1.lineStyle( 3, 0xff0000 )
clip1.moveTo( 10, 10 )
clip1.lineTo( 100, 10 )
clip1.lineTo( 100, 100 )
clip1.lineTo( 10, 100 )
clip1.lineTo( 10, 10 )
clip1.lineStyle( 3, 0x00ff00 )
clip1.moveTo( 30, 30 )
clip1.lineTo( 80, 30 )
clip1.lineTo( 80, 80 )
clip1.lineTo( 30, 80 )
clip1.lineTo( 30, 30 )

After typing in the code, click the tab to show "experiment1.fla". Then choose "Test Movie" from the "Control" Menu:

This is what you should see:
Once you get this far you can close the test window and start playing around the the computer program. Click the tab to go back to myScript.as and try some experiments. After each try, remember click the "experiment1.fla" tab and choose "Test Movie" again.
- What happens if you change 0xff0000 in line 2 to 0x00ff00 ? or to 0x0000ff? or 0x123456?
- What happens if you change one of the 100 s to a 200?
- Instead of drawing squares, can you figure out how to draw a triangle? A shape with 5 sides? A zig-zag line?
Here is what I did with my drawing. I used a "for" loop -- something I hope I'll have time to tell you about later!
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home