Đang chuẩn bị liên kết để tải về tài liệu:
Học Actionscript 3.0 - p 26

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

The BitmapData Class opacity, and then 0000FF, or blue, for the color. The result of this script is a 100 × 100–pixel, 100-percent opaque, blue square positioned at (0, 0). N OT E Creating Bitmaps with Transparency To create a bitmap data object with transparency, you must change the third parameter of the class constructor to true and then reduce the opacity of the color value. The first pair of characters in the hexadecimal number (from left to right) represents alpha (AA in the 32-bit format listed previously). The acceptable alpha range is 00 (fully transparent) to FF (fully opaque). For example, the following. | The BitmapData Class opacity and then 0000FF or blue for the color. The result of this script is a 100 x 100-pixel 100-percent opaque blue square positioned at 0 0 . Creating Bitmaps with Transparency To create a bitmap data object with transparency you must change the third parameter of the class constructor to true and then reduce the opacity of the color value. The first pair of characters in the hexadecimal number from left to right represents alpha AA in the 32-bit format listed previously . The acceptable alpha range is 00 fully transparent to FF fully opaque . For example the following code found in the bitmap_from_scratch_transparency. fla source file creates a green square that is 50-percent transparent. The alpha value is 80 or half of the alpha range. The color that follows is then 00FF00 or green corresponding with the RRGGBB format. 1 2 3 var bmd BitmapData new BitmapData 100 100 true 0x8000FF00 var bm Bitmap new Bitmap bmd addChild bm NOTE The hexadecimal value 0x80 is equivalent to 128 or half of the 0-255 range for red blue green and alpha channels of a color. Using a Bitmap from the Library If you need to work with an actual bitmap image rather than originating your own BitmapData object you can add an imported bitmap dynamically from the library. You can use the bitmap_from_library.fla file from the accompanying source code for this exercise or use your own image. You must have an image already imported into the library and have given it a class name in the Linkage Properties dialog. In our sample source file a 550 x 400-pixel image of penguins has been given the linkage class name Penguins. Discussed briefly in Chapter 8 the base class for a library bitmap is BitmapData. This allows you to easily access the data without requiring that you first create an instance of the Bitmap. If you want to display a bitmap objects for both BitmapData and Bitmap must be created. NOTE When adding a linkage class name to a symbol you needn t actually create a .