• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 20. ActionScript: Write Scripts > Create an instance of a symbol

Create an instance of a symbol

You’ll drag an instance of an animated movie clip from the library to the Global Positioning System artwork on the Stage. You’ll then follow the recommended practice of always naming instances—both to prompt code hinting and because in your scripts you generally refer to instance names rather than symbol names. Code hints are the tooltips that prompt you with the correct ActionScript syntax.

In the Tools panel, click the Selection tool. Select the map layer in the Timeline, and click the padlock next to the map layer to unlock that layer.

To place the movie clip accurately, select View > Snapping. Select Snap Align and Snap to Objects if the commands are not already selected.

From the Library panel (Window > Library), drag map_skewed to the black background area of the Stage.

Because guides don’t appear when you first drag an object from the Library panel, you’ll release the object, and then drag it again.

Drag the map_skewed movie clip on the Stage again so that the align guides appear. Use the guides to align the movie clip to the top and left edges of the GPS screen.


If you make an error in placement, either drag the movie clip again, or press Control+Z (Windows) or Command+Z (Macintosh) to undo your changes.

With the instance of map_skewed selected on the Stage, type screen_mc in the Instance Name text box of the Property inspector (Window > Properties).

Flash is designed to present code hints when you name your instances with the appropriate suffix:

  • When naming a movie clip instance, always give the instance a suffix of _mc, as in screen_mc.

  • When naming a button, use the _btn suffix.

  • When naming a text field, use the _txt suffix.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint