Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Working with Images, Sound, and Video > Assigning linkage to assets in the library | |||
You can assign linkage identifiers for assets in the library, such as movie clips and font symbols. In Flash, you can set linkage identifiers to sound and image assets in the library. This supports using image and sound files with shared libraries and with the new BitmapData class.
The following example adds a bitmap image in the library with a linkage set to myImage. Then you add the image to the Stage and make it draggable.
import flash.display.BitmapData;
// Create imageBmp and attach the bitmap from the library.
var imageBmp:BitmapData = BitmapData.loadBitmap("myImage");
// create movie clip and attach imageBmp
this.createEmptyMovieClip("imageClip", 10);
imageClip.attachBitmap(imageBmp, 2);
// make the clip draggable
imageClip.onPress = function() {
this.startDrag();
};
imageClip.onRelease = function() {
this.stopDrag();
}
The bitmap in the library appears on the Stage, and the image is draggable.
Flash CS3