Flash 8 let you load bitmap information from the library using a linkage ID and the BitmapData.loadBitmap() method. This is no longer the case with Flash 9 and ActionScript 3. Now, as with timelines and movie clips in the library, Bitmaps are associated with classes. If you do not specify a specific class to be related to your bitmap in the library, you can name one which will be created automatically when publishing the SWF.
Classes associatated with bitmaps in the library are subclasses of BitmapData (flash.display.BitmapData). These are then instantiated as instances in ActionScript using the new keyword. As BitmapData instances, before being able to be seen on the screen, they would need to be associated with a Bitmap (flash.display.Bitmap) instance which is a display object capabale of being added to a display list (BitmapData instances cannot be added to display lists).
As an example, lets say you imported a bitmap of
ActionScript Code:
// create instance of RomeImage bitmap data
var romeImageData:RomeImage = new RomeImage();
// create a bitmap instance that references the RomeImage instance
var romeImageBitmap:Bitmap = new Bitmap(romeImageData);
// add the new bitmap to the display list
addChild(romeImageBitmap);
0 评论:
发表评论