Flash CS3 Documentation |
|||
| Programming ActionScript 3.0 > Object-oriented programming in ActionScript > Classes > Embedded asset classes | |||
ActionScript 3.0 uses special classes, called embedded asset classes, to represent embedded assets. An embedded asset is an asset, such as a sound, image, or font, that is included in a SWF file at compile time. Embedding an asset instead of loading it dynamically ensures that it will be available at run time, but at the cost of increased SWF file size.
To embed an asset, first place the asset into a FLA file's library. Next, use the asset's linkage property to provide a name for the asset's embedded asset class. If a class by that name cannot be found in the classpath, a class is automatically generated for you. You can then create an instance of the embedded asset class and use any properties and methods defined or inherited by that class. For example, the following code can be used to play an embedded sound that is linked to an embedded asset class named PianoMusic:
var piano:PianoMusic = new PianoMusic(); var sndChannel:SoundChannel = piano.play();
Flash CS3
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000066.html
Comments
petit said on Sep 5, 2007 at 3:11 PM : Cor van Dooren said on Mar 24, 2008 at 6:00 AM :