Chapter 7. Working with Library and Linkage Changes

Like its forerunner, ActionScript 3.0 supports the attachment of library assets at runtime, but the mechanics have changed. The only class methods that now contain the word “attach” relate to connecting the SWF file to an external device, such as NetStream.attachCamera(), which lets the user transmit webcam input. You don’t find familiar methods like MovieClip.attachMovie() and Sound.attachSound() anywhere, so how can you access the library now at runtime? The answer’s gratifyingly elegant, and even in its simple approach, ActionScript 3.0 gives you more elaborate options than before.

Linkages Now Reference Classes

Prior to ActionScript 3.0, you could optionally assign library assets a linkage identifier in the Library panel. This procedure provided a unique label for the chosen asset, so that you could single it out at runtime when needed, and pull it to the stage. Linkage identifiers are still possible in Flash CS4 Professional when a FLA file is configured for an older version of ActionScript. To access an asset’s linkage properties, right-click (Ctrl-click) the asset as shown in Figure 7-1, and then select Properties.

Right-click (Ctrl-click) an asset to access its linkage properties
Figure 7-1. Right-click (Ctrl-click) an asset to access its linkage properties

Selecting Properties opens the Symbol Properties dialog box, whose Linkage area is initially the same for documents configured for any version ...

Get The ActionScript 3.0 Quick Reference Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.