Flash: ActionScript Language Reference- P7

Chia sẻ: Thanh Cong | Ngày: | Loại File: PDF | Số trang:100

0
41
lượt xem
5
download

Flash: ActionScript Language Reference- P7

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Tham khảo tài liệu 'flash: actionscript language reference- p7', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả

Chủ đề:
Lưu

Nội dung Text: Flash: ActionScript Language Reference- P7

  1. Listener summary for the MovieClipLoader class Listener Description MovieClipLoader.onLoadComplete Invoked when a file loaded with MovieClipLoader.loadClip() has completely downloaded. MovieClipLoader.onLoadError Invoked when a file loaded with MovieClipLoader.loadClip() has failed to load. MovieClipLoader.onLoadInit Invoked when the actions on the first frame of the loaded clip have been executed. MovieClipLoader.onLoadProgress Invoked every time the loading content is written to disk during the loading process. MovieClipLoader.onLoadStart Invoked when a call to MovieClipLoader.loadClip() has successfully begun to download a file. Constructor for the MovieClipLoader class Availability Flash Player 7. Usage new MovieClipLoader() : MovieClipLoader Parameters None. Returns A reference to a MovieClipLoader object. Description Constructor; creates a MovieClipLoader object that you can use to implement a number of listeners to respond to events while a SWF or JPEG file is downloading. Example See MovieClipLoader.loadClip(). See also MovieClipLoader.addListener() MovieClipLoader class 601
  2. MovieClipLoader.addListener() Availability Flash Player 7. Usage my_mcl.addListener(listenerObject:Object) : Void Parameters listenerObject An object that listens for a callback notification from the MovieClipLoader event handlers. Returns Nothing. Description Method; registers an object to receive notification when a MovieClipLoader event handler is invoked. Example The following example loads an image into a movie clip called image_mc. The movie clip instance is rotated and centered on the Stage, and both the Stage and movie clip have a stroke drawn around their perimeters. this.createEmptyMovieClip("image_mc", this.getNextHighestDepth()); var mclListener:Object = new Object(); mclListener.onLoadInit = function(target_mc:MovieClip) { target_mc._x = Stage.width/2-target_mc._width/2; target_mc._y = Stage.height/2-target_mc._width/2; var w:Number = target_mc._width; var h:Number = target_mc._height; target_mc.lineStyle(4, 0x000000); target_mc.moveTo(0, 0); target_mc.lineTo(w, 0); target_mc.lineTo(w, h); target_mc.lineTo(0, h); target_mc.lineTo(0, 0); target_mc._rotation = 3; }; var image_mcl:MovieClipLoader = new MovieClipLoader(); image_mcl.addListener(mclListener); image_mcl.loadClip("http://www.macromedia.com/images/shared/product_boxes/ 112x112/box_studio_112x112.jpg", image_mc); See also MovieClipLoader.onLoadComplete, MovieClipLoader.onLoadError, MovieClipLoader.onLoadInit, MovieClipLoader.onLoadProgress, MovieClipLoader.onLoadStart, MovieClipLoader.removeListener() 602 Chapter 2: ActionScript Language Reference
  3. MovieClipLoader.getProgress() Availability Flash Player 7. Usage my_mcl.getProgress(target_mc:Object) : Object Parameters target_mc A SWF or JPEG file that is loaded using MovieClipLoader.loadClip(). Returns An object that has two integer properties: bytesLoaded and bytesTotal. Description Method; returns the number of bytes loaded and total number of bytes for a file that is being loaded using MovieClipLoader.loadClip(); for compressed movies, it reflects the number of compressed bytes. This method lets you explicitly request this information, instead of (or in addition to) writing a MovieClipLoader.onLoadProgress listener function. Example The following example loads an image into a draggable, dynamically created movie clip called image_mc. The number of bytes loaded and the total number of bytes for the loaded image display in a dynamically created text field called filesize_txt. this.createEmptyMovieClip("image_mc", this.getNextHighestDepth()); var mclListener:Object = new Object(); mclListener.onLoadInit = function(target_mc:MovieClip) { target_mc.onPress = function() { this.startDrag(); }; target_mc.onRelease = function() { this.stopDrag(); }; var mclProgress:Object = image_mcl.getProgress(target_mc); target_mc.createTextField("filesize_txt", target_mc.getNextHighestDepth(), 0, target_mc._height, target_mc._width, 22); target_mc.filesize_txt.text = mclProgress.bytesLoaded+" of "+mclProgress.bytesTotal+" bytes loaded"; }; var image_mcl:MovieClipLoader = new MovieClipLoader(); image_mcl.addListener(mclListener); image_mcl.loadClip("http://www.macromedia.com/images/shared/product_boxes/ 112x112/box_studio_112x112.jpg", image_mc); See also MovieClipLoader.onLoadProgress MovieClipLoader.getProgress() 603
  4. MovieClipLoader.loadClip() Availability Flash Player 7. Usage my_mcl.loadClip(url:String, target:Object ) : Boolean Parameters url The absolute or relative URL of the SWF file or JPEG file to be loaded. A relative path must be relative to the SWF file at level 0. Absolute URLs must include the protocol reference, such as http:// or file:///. Filenames cannot include disk drive specifications. target The target path of a movie clip, or an integer specifying the level in Flash Player into which the movie will be loaded. The target movie clip is replaced by the loaded SWF file or image. Returns A Boolean value. The return value is true if the URL request was sent successfully; otherwise the return value is false. Description Method; loads a SWF or JPEG file into a movie clip in Flash Player while the original movie is playing. Using this method lets you display several SWF files at once and switch between SWF files without loading another HTML document. Using this method instead of loadMovie() or MovieClip.loadMovie() has a number of advantages. The following handlers are implemented by the use on a listener object, which is registered with the MovieClipLoader class using MovieClipLoader.addListener(listenerObject). • The MovieClipLoader.onLoadStart handler is invoked when loading begins. • The MovieClipLoader.onLoadError handler is invoked if the clip cannot be loaded. • The MovieClipLoader.onLoadProgress handler is invoked as the loading process progresses. • The MovieClipLoader.onLoadInit handler is invoked after the actions in the first frame of the clip have executed, so you can begin manipulating the loaded clip. • The MovieClipLoader.onLoadComplete handler is invoked when a file has completed downloading. A SWF file or image loaded into a movie clip inherits the position, rotation, and scale properties of the movie clip. You can use the target path of the movie clip to target the loaded movie. You can use the loadClip() method to load one or more files into a single movie clip or level; MovieClipLoader listener objects are passed the loading target movie clip instance as a parameter. Alternately, you can create a different MovieClipLoader object for each file you load. Use MovieClipLoader.unloadClip() to remove movies or images loaded with this method or to cancel a load operation that is in progress. 604 Chapter 2: ActionScript Language Reference
  5. MovieClipLoader.getProgress() and MovieClipLoaderListener.onLoadProgress do not report the actual bytesLoaded and bytesTotal values in the Authoring player when the files are local. When you use the Bandwidth Profiler feature in the authoring environment, MovieClipLoader.getProgress() and MovieClipLoaderListener.onLoadProgress report the download at the actual download rate, not at the reduced bandwidth rate that the Bandwidth Profiler provides. Example The following example illustrates the use of many of the MovieClipLoader class methods and listeners: // first set of listeners var my_mcl:MovieClipLoader = new MovieClipLoader(); var myListener:Object = new Object(); myListener.onLoadStart = function(target_mc:MovieClip) { trace("*********First my_mcl instance*********"); trace("Your load has begun on movie clip = "+target_mc); var loadProgress:Object = my_mcl.getProgress(target_mc); trace(loadProgress.bytesLoaded+" = bytes loaded at start"); trace(loadProgress.bytesTotal+" = bytes total at start"); }; myListener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number, totalBytes:Number) { trace("*********First my_mcl instance Progress*********"); trace("onLoadProgress() called back on movie clip "+target_mc); trace(loadedBytes+" = bytes loaded at progress callback"); trace(totalBytes+" = bytes total at progress callback"); }; myListener.onLoadComplete = function(target_mc:MovieClip) { trace("*********First my_mcl instance*********"); trace("Your load is done on movie clip = "+target_mc); var loadProgress:Object = my_mcl.getProgress(target_mc); trace(loadProgress.bytesLoaded+" = bytes loaded at end"); trace(loadProgress.bytesTotal+" = bytes total at end"); }; myListener.onLoadInit = function(target_mc:MovieClip) { trace("*********First my_mcl instance*********"); trace("Movie clip = "+target_mc+" is now initialized"); // you can now do any setup required, for example: target_mc._width = 100; target_mc._height = 100; }; myListener.onLoadError = function(target_mc:MovieClip, errorCode:String) { trace("*********First my_mcl instance*********"); trace("ERROR CODE = "+errorCode); trace("Your load failed on movie clip = "+target_mc+"\n"); }; my_mcl.addListener(myListener); // Now load the files into their targets. // loads into movie clips this.createEmptyMovieClip("clip1_mc", this.getNextHighestDepth()); clip1_mc._x = 400; this.createEmptyMovieClip("clip2_mc", this.getNextHighestDepth()); MovieClipLoader.loadClip() 605
  6. my_mcl.loadClip("http://www.macromedia.com/software/drk/images/box_drk5.jpg", clip1_mc); my_mcl.loadClip("http://www.macromedia.com/devnet/images/160x160/ ben_forta.jpg", clip2_mc); clip2_mc._x = 200; // loads into _level1 my_mcl.loadClip("http://www.macromedia.com/devnet/images/160x160/ mike_chambers.jpg", 1); // // Second set of listeners var another_mcl:MovieClipLoader = new MovieClipLoader(); var myListener2:Object = new Object(); myListener2.onLoadStart = function(target_mc:MovieClip) { trace("*********Second my_mcl instance*********"); trace("Your load has begun on movie = "+target_mc); var loadProgress:Object = my_mcl.getProgress(target_mc); trace(loadProgress.bytesLoaded+" = bytes loaded at start"); trace(loadProgress.bytesTotal+" = bytes total at start"); }; myListener2.onLoadComplete = function(target_mc:MovieClip) { trace("*********Second my_mcl instance*********"); trace("Your load is done on movie clip = "+target_mc); var loadProgress:Object = my_mcl.getProgress(target_mc); trace(loadProgress.bytesLoaded+" = bytes loaded at end"); trace(loadProgress.bytesTotal+" = bytes total at end"); }; myListener2.onLoadError = function(target_mc:MovieClip, errorCode:String) { trace("*********Second my_mcl instance*********"); trace("ERROR CODE = "+errorCode); trace("Your load failed on movie clip = "+target_mc+"\n"); }; another_mcl.addListener(myListener2); /* Now load the files into their targets (using the second instance of MovieClipLoader) */ another_mcl.loadClip("http://www.macromedia.com/devnet/images/160x160/ flex_logo.jpg", this.createEmptyMovieClip("clip4_mc", this.getNextHighestDepth())); clip4_mc._y = 200; // Issue the following statements after the download is complete, // and after my_mcl.onLoadInit has been called. // my_mcl.removeListener(myListener); // my_mcl.removeListener(myListener2); See also MovieClipLoader.unloadClip() 606 Chapter 2: ActionScript Language Reference
  7. MovieClipLoader.onLoadComplete Availability Flash Player 7. Usage listenerObject.onLoadComplete = function([target_mc:Object]) { // your statements here } Parameters listenerObject A listener object that was added using MovieClipLoader.addListener(). target_mc A movie clip loaded by a MovieClipLoader.loadClip() method. This parameter is optional. Returns Nothing. Description Listener; invoked when a file loaded with MovieClipLoader.loadClip() has completely downloaded. The value for target_mc identifies the movie clip for which this call is being made. This is useful if multiple files are being loaded with the same set of listeners. This parameter is passed by Flash to your code, but you do not have to implement all of the parameters in the listener function. When you use the onLoadComplete and onLoadInit events with the MovieClipLoader class, it’s important to understand how this differs from the way they work with your SWF file. The onLoadComplete event is called after the SWF or JPEG file has loaded, but before the application has been initialized. At this point it is impossible to access the loaded movie clip’s methods and properties, and because of this you cannot call a function, move to a specific frame, and so on. In most situations, it’s better to use the onLoadInit event instead, which is called after the content has loaded and is fully initialized. Example The following example loads an image into a movie clip instance called image_mc. The onLoadInit and onLoadComplete events are used to determine how long it takes to load the image. The information displays in a dynamically created text field called timer_txt. this.createEmptyMovieClip("image_mc", this.getNextHighestDepth()); var mclListener:Object = new Object(); mclListener.onLoadStart = function(target_mc:MovieClip) { target_mc.startTimer = getTimer(); }; mclListener.onLoadComplete = function(target_mc:MovieClip) { target_mc.completeTimer = getTimer(); }; mclListener.onLoadInit = function(target_mc:MovieClip) { var timerMS:Number = target_mc.completeTimer-target_mc.startTimer; MovieClipLoader.onLoadComplete 607
  8. target_mc.createTextField("timer_txt", target_mc.getNextHighestDepth(), 0, target_mc._height, target_mc._width, 22); target_mc.timer_txt.text = "loaded in "+timerMS+" ms."; }; var image_mcl:MovieClipLoader = new MovieClipLoader(); image_mcl.addListener(mclListener); image_mcl.loadClip("http://www.macromedia.com/images/shared/product_boxes/ 112x112/box_studio_112x112.jpg", image_mc); See also MovieClipLoader.addListener(), MovieClipLoader.onLoadStart, MovieClipLoader.onLoadError 608 Chapter 2: ActionScript Language Reference
  9. MovieClipLoader.onLoadError Availability Flash Player 7. Usage listenerObject.onLoadError = function(target_mc:Object, errorCode:String) { // your statements here } Parameters listenerObject A listener object that was added using MovieClipLoader.addListener(). target_mc A movie clip loaded by a MovieClipLoader.loadClip() method. errorCode A string that explains the reason for the failure. Returns One of two strings: "URLNotFound" or "LoadNeverCompleted". Description Listener; invoked when a file loaded with MovieClipLoader.loadClip() has failed to load. The string "URLNotFound" is returned if neither the MovieClipLoader.onLoadStart or MovieClipLoader.onLoadComplete listener has been called. For example, if a server is down or the file is not found, these listeners are not called. The string "LoadNeverCompleted" is returned if MovieClipLoader.onLoadStart was called but MovieClipLoader.onLoadComplete was not called. For example, if MovieClipLoader.onLoadStart is called but the download is interrupted due to server overload, server crash, and so on, MovieClipLoader.onLoadComplete will not be called. The value for target_mc identifies the movie clip this call is being made for. This is useful if you are loading multiple files with the same set of listeners. This optional parameter is passed to your ActionScript. Example The following example displays information in the Output panel when an image fails to load. This occurs when you test the following ActionScript, because the image does not exist in the specified location. this.createEmptyMovieClip("image_mc", this.getNextHighestDepth()); var mclListener:Object = new Object(); mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String) { trace("ERROR!"); switch (errorCode) { case 'URLNotFound' : trace("\t Unable to connect to URL: "+target_mc._url); break; case 'LoadNeverCompleted' : trace("\t Unable to complete download: "+target_mc); break; MovieClipLoader.onLoadError 609
  10. } }; mclListener.onLoadInit = function(target_mc:MovieClip) { trace("success"); trace(image_mcl.getProgress(target_mc).bytesTotal+" bytes loaded"); }; var image_mcl:MovieClipLoader = new MovieClipLoader(); image_mcl.addListener(mclListener); image_mcl.loadClip("http://www.fakedomain.com/images/bad_hair_day.jpg", image_mc); 610 Chapter 2: ActionScript Language Reference
  11. MovieClipLoader.onLoadInit Availability Flash Player 7. Usage listenerObject.onLoadInit = function([target_mc:MovieClip]) { // your statements here } Parameters listenerObject A listener object that was added using MovieClipLoader.addListener(). target_mc A movie clip loaded by a MovieClipLoader.loadClip() method. This parameter is optional. Returns Nothing. Description Listener; invoked when the actions on the first frame of the loaded clip have been executed. After this listener has been invoked, you can set properties, use methods, and otherwise interact with the loaded movie. The value for target_mc identifies the movie clip this call is being made for. This is useful if you are loading multiple files with the same set of listeners. This optional parameter is passed to your ActionScript. Example The following example loads an image into a movie clip instance called image_mc. The onLoadInit and onLoadComplete events are used to determine how long it takes to load the image. This information displays in a text field called timer_txt. this.createEmptyMovieClip("image_mc", this.getNextHighestDepth()); var mclListener:Object = new Object(); mclListener.onLoadStart = function(target_mc:MovieClip) { target_mc.startTimer = getTimer(); }; mclListener.onLoadComplete = function(target_mc:MovieClip) { target_mc.completeTimer = getTimer(); }; mclListener.onLoadInit = function(target_mc:MovieClip) { var timerMS:Number = target_mc.completeTimer-target_mc.startTimer; target_mc.createTextField("timer_txt", target_mc.getNextHighestDepth(), 0, target_mc._height, target_mc._width, 22); target_mc.timer_txt.text = "loaded in "+timerMS+" ms."; }; var image_mcl:MovieClipLoader = new MovieClipLoader(); image_mcl.addListener(mclListener); image_mcl.loadClip("http://www.macromedia.com/images/shared/product_boxes/ 112x112/box_studio_112x112.jpg", image_mc); MovieClipLoader.onLoadInit 611
  12. See also MovieClipLoader.onLoadStart 612 Chapter 2: ActionScript Language Reference
  13. MovieClipLoader.onLoadProgress Availability Flash Player 7. Usage listenerObject.onLoadProgress = function([target_mc:Object [, loadedBytes:Number [, totalBytes:Number ] ] ] ) { // your statements here } Parameters listenerObject A listener object that was added using MovieClipLoader.addListener(). target_mc A movie clip loaded by a MovieClipLoader.loadClip() method. This parameter is optional. loadedBytes The number of bytes that had been loaded when the listener was invoked. totalBytes The total number of bytes in the file being loaded. Returns Nothing. Description Listener; invoked every time the loading content is written to disk during the loading process (that is, between MovieClipLoader.onLoadStart and MovieClipLoader.onLoadComplete). You can use this method to display information about the progress of the download, using the loadedBytes and totalBytes parameters. The value for target_mc identifies the movie clip this call is being made for. This is useful if you are loading multiple files with the same set of listeners. This optional parameter is passed to your ActionScript. Example The following example creates a progress bar using the Drawing API. The progress bar displays the loading progress of an image using the onLoadProgress listener. When the image finishes loading, the progress bar is removed from the Stage. You must replace the URL parameter of the image_mcl.loadClip() command so that the parameter refers to a valid JPEG file using HTTP. If you attempt to use this example to load a local file that resides on your hard disk, this example will not work properly because, in test movie mode, Flash Player loads local files in their entirety. Add the following ActionScript to your FLA or AS file: this.createEmptyMovieClip("progressBar_mc", 0); progressBar_mc.createEmptyMovieClip("bar_mc", 1); progressBar_mc.createEmptyMovieClip("stroke_mc", 2); with (progressBar_mc.stroke_mc) { lineStyle(0, 0x000000); moveTo(0, 0); lineTo(100, 0); MovieClipLoader.onLoadProgress 613
  14. lineTo(100, 10); lineTo(0, 10); lineTo(0, 0); } with (progressBar_mc.bar_mc) { beginFill(0xFF0000, 100); moveTo(0, 0); lineTo(100, 0); lineTo(100, 10); lineTo(0, 10); lineTo(0, 0); endFill(); _xscale = 0; } progressBar_mc._x = 2; progressBar_mc._y = 2; // var mclListener:Object = new Object(); mclListener.onLoadStart = function(target_mc:MovieClip) { progressBar_mc.bar_mc._xscale = 0; }; mclListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) { progressBar_mc.bar_mc._xscale = Math.round(bytesLoaded/bytesTotal*100); }; mclListener.onLoadComplete = function(target_mc:MovieClip) { progressBar_mc.removeMovieClip(); }; mclListener.onLoadInit = function(target_mc:MovieClip) { target_mc._height = 320; target_mc._width = 240; }; this.createEmptyMovieClip("image_mc", 100); var image_mcl:MovieClipLoader = new MovieClipLoader(); image_mcl.addListener(mclListener); image_mcl.loadClip("[place a valid URL pointing to a JPEG file here]", image_mc); See also MovieClipLoader.getProgress() 614 Chapter 2: ActionScript Language Reference
  15. MovieClipLoader.onLoadStart Availability Flash Player 7. Usage listenerObject.onLoadStart = function([target_mc:Object]) { // your statements here } Parameters listenerObject A listener object that was added using MovieClipLoader.addListener(). target_mc A movie clip loaded by a MovieClipLoader.loadClip() method. This parameter is optional. Returns Nothing. Description Listener; invoked when a call to MovieClipLoader.loadClip() has successfully begun to download a file. The value for target_mc identifies the movie clip this call is being made for. This is useful if you are loading multiple files with the same set of listeners. This optional parameter is passed to your ActionScript. Example The following example loads an image into a movie clip instance called image_mc. The onLoadInit and onLoadComplete events are used to determine how long it takes to load the image. This information displays in a text field called timer_txt. this.createEmptyMovieClip("image_mc", this.getNextHighestDepth()); var mclListener:Object = new Object(); mclListener.onLoadStart = function(target_mc:MovieClip) { target_mc.startTimer = getTimer(); }; mclListener.onLoadComplete = function(target_mc:MovieClip) { target_mc.completeTimer = getTimer(); }; mclListener.onLoadInit = function(target_mc:MovieClip) { var timerMS:Number = target_mc.completeTimer-target_mc.startTimer; target_mc.createTextField("timer_txt", target_mc.getNextHighestDepth(), 0, target_mc._height, target_mc._width, 22); target_mc.timer_txt.text = "loaded in "+timerMS+" ms."; }; var image_mcl:MovieClipLoader = new MovieClipLoader(); image_mcl.addListener(mclListener); image_mcl.loadClip("http://www.macromedia.com/images/shared/product_boxes/ 112x112/box_studio_112x112.jpg", image_mc); MovieClipLoader.onLoadStart 615
  16. See also MovieClipLoader.onLoadError, MovieClipLoader.onLoadInit, MovieClipLoader.onLoadComplete 616 Chapter 2: ActionScript Language Reference
  17. MovieClipLoader.removeListener() Availability Flash Player 7. Usage my_mcl.removeListener(listenerObject:Object) : Void Parameters listenerObject A listener object that was added using MovieClipLoader.addListener(). Returns Nothing. Description Method; removes the listener that was used to receive notification when a MovieClipLoader event handler was invoked. No further loading messages will be received. Example The following example loads an image into a movie clip, and enables the user to start and stop the loading process using two buttons called start_button and stop_button. When the user starts or stops the progress, information is displayed in the Output panel. this.createEmptyMovieClip("image_mc", this.getNextHighestDepth()); var mclListener:Object = new Object(); mclListener.onLoadStart = function(target_mc:MovieClip) { trace("\t onLoadStart"); }; mclListener.onLoadComplete = function(target_mc:MovieClip) { trace("\t onLoadComplete"); }; mclListener.onLoadError = function(target_mc:MovieClip, errorCode:String) { trace("\t onLoadError: "+errorCode); }; mclListener.onLoadInit = function(target_mc:MovieClip) { trace("\t onLoadInit"); start_button.enabled = true; stop_button.enabled = false; }; var image_mcl:MovieClipLoader = new MovieClipLoader(); // start_button.clickHandler = function() { trace("Starting..."); start_button.enabled = false; stop_button.enabled = true; // image_mcl.addListener(mclListener); image_mcl.loadClip("http://www.macromedia.com/devnet/images/160x160/ flex_logo.jpg", image_mc); }; stop_button.clickHandler = function() { trace("Stopping..."); MovieClipLoader.removeListener() 617
  18. start_button.enabled = true; stop_button.enabled = false; // image_mcl.removeListener(mclListener); }; stop_button.enabled = false; 618 Chapter 2: ActionScript Language Reference
  19. MovieClipLoader.unloadClip() Availability Flash Player 7. Usage my_mcl.unloadClip(target:Object) Parameters target The string or integer passed to the corresponding call to my_mcl.loadClip(). Returns Nothing. Description Method; removes a movie clip that was loaded by means of MovieClipLoader.loadClip(). If you issue this command while a movie is loading, MovieClipLoader.onLoadError is invoked. Example The following example loads an image into a movie clip called image_mc. If you click the movie clip, the movie clip is removed and information is displayed in the Output panel. this.createEmptyMovieClip("image_mc", this.getNextHighestDepth()); var mclListener:Object = new Object(); mclListener.onLoadInit = function(target_mc:MovieClip) { target_mc._x = 100; target_mc._y = 100; target_mc.onRelease = function() { trace("Unloading clip..."); trace("\t name: "+target_mc._name); trace("\t url: "+target_mc._url); image_mcl.unloadClip(target_mc); }; }; var image_mcl:MovieClipLoader = new MovieClipLoader(); image_mcl.addListener(mclListener); image_mcl.loadClip("http://www.macromedia.com/devnet/images/160x160/ flex_logo.jpg", image_mc); See also MovieClipLoader.loadClip() MovieClipLoader.unloadClip() 619
  20. CHAPTER 2 ActionScript Language Reference NaN Availability Flash Player 5. Usage NaN Description Variable; a predefined variable with the IEEE-754 value for NaN (not a number). To determine if a number is NaN, use isNaN(). See also isNaN(), Number.NaN 620 Chapter 2: ActionScript Language Reference
Đồng bộ tài khoản