Essential ActionScript 3.0 PHẦN 10

Vị trí của tài sản (hình ảnh, tập tin swf, hoặc biểu tượng movie clip) để nhúng vào lĩnh vực văn bản chiều rộng tùy chọn của tài sản được nhúng Chiều cao tùy chọn của tài sản được nhúng vào tùy chọn liên kết ngang của tài sản được nhúng vào | When using getDefinition we must be sure the .swf file instance has initialized before we attempt to access its symbols or classes. To do so we register with the embedded asset object s Loaderinfo object for events. Depending on how the .swf file was embedded we access Loaderinfo in different ways. If the .swf file was embedded directly at the variable level we use the following code to register for events Instantiate the asset object var embeddedInstance MovieClipLoaderAsset new ClassName Register for Loader 0 . initListener In the preceding code ClassName is the variable that refers to the class representing the embedded .swf file embeddedInstance is an instance of ClassName and initListener is a reference to the function that will execute when the instance is initialized. On the other hand if the .swf file was embedded as binary data we use the following code to register for event notification Instantiate the asset object var binarydata ByteArrayAsset new BinaryData Generate a display object representing the .swf file var loader Loader new Loader binarydata addChild loader Register for initListener where BinaryData is the variable that refers to the class representing the embedded .swf file s binary data binarydata is an instance of BinaryData and initListener is once again a reference to the function that will execute when the .swf file instance is initialized. The following code shows an example event listener that retrieves a reference to a movie-clip symbol s class named Ball. The code also creates an instance of the Ball symbol and adds it to the initListener s class s display hierarchy. private function initListener e Event void Obtain a reference to the Ball symbol from the embedded .swf file var BallSymbol Class .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.