Flash How To: Naming Objects
The very basics of Flash and ActionScript are the objects and classes. Sound, Graphic and Text are a few examples of Data Type Objects. A data object can pull information from a source of you choice, such as an array, XML or simply the time. All objects belong to a larger group referred to as classes. Flash has prebuilt class that help flash understand how to handle data. such as Array, Math, Sound and Video.
Objects need to be named for ActionScript to be able to use the object. When you have the object on the stage and selected you can enter the name in this field.
Flash How to: Applying a Method
In the file you will find a box called “box”. First you need to name the box, currently it is called box in the Library, but for ActionScript it needs to be named in the Properties panel. (see example above). Click on the box symbol and go to the Properties panel. Name this box “box_mc”
The object has been named, so lets make the object do something, such as following the mouse around. Open the Actions panel (press F9)
select the first key frame in the actions layer and
then add the following code:
This Code calls the method “startDrag()” a built in in feature of Flash. You named the box “box_mc“ so “startDrag()“ is applied to “box_mc“
Now press contol-enter to publish this file. When you run your mouse over the .swf you will see the box follow your mouse. A .swf is the file extension that flash uses to create a file referred to as a movie. You can then embed the .swf into an html page. If you haven't changed the name of your flash file you will see that pressing control-enter created a new file called start01.swf.
Press Control-Enter and test your flash tutorial.