Chapter 20 Example 3

by actionscriptbible
♥0 | Line 20 | Modified 2009-07-02 01:40:55 | MIT License
play

ActionScript3 source code

/**
 * Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/4G5b
 */

package {
  import com.actionscriptbible.Example;
  import flash.display.Loader;
  import flash.display.LoaderInfo;
  import flash.events.Event;
  import flash.net.URLRequest;
  
  public class ch20ex3 extends Example {
    public function ch20ex3() {
      var l:Loader = new Loader();
      l.load(new URLRequest("http://actionscriptbible.com/files/roger.gif"));
      l.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
      l.y = 30;
      addChild(l);
    }
    
    protected function onLoadComplete(event:Event):void {
      event.target.removeEventListener(Event.COMPLETE, onLoadComplete);
      trace("done loading, listener removed");
    }
  }
}