This is the first one.
Displaying a Block
- 1. Open a new Flashfile(ActionScript 3.0)
- 2. Create a rectangle and convert it to a movieclipUsing the Rectangle tool create a new rectangle,Use selection tool and group the rectangle together
Right click the rectangle and select Convert to Symbol..
In the Convert to Symbol dialog box Enter Block in the Name: textfield
Select the radio button for Movie Clip
Click the Advanced button
Under Linkage select the Export for ActionScript checkbox
(this will also check the Export in first frame button Leave it checked)
ActionScript Class warning message box will pop up Select Ok
After converting to symbol make sure your stage is clear
- 3. ActionScript Code
Select frame 1 right click and select Actions from drop down menu or press F9 to open Actions window In the Actions window typeimport flash.display.*;
This basically lets flash know that we will be working with display objects and events so it can load the code to handle these things.
- Next we want to define a variable to represent our display object in this case the block we createdvar myBlock:DisplayObject= new Block()
- At this point we have a variable(myBlock) representing our display object
We can now use ActionScript to alter the display object properties of our variable Let us set the starting point for myBlock before we draw it to the screenmyBlock.x=300
- Now we create myBlock on screenthis.addChild(myBlock)
- Publish preview and you should now have a block sitting on screen at the (X,Y) position that you specified.
This may not seem like much right now, however we now have the ability to change properties of our object with ActionScript code
Go check out his page for the others.