Return to Snippet

Revision: 11863
at February 22, 2009 15:53 by dx0ne


Initial Code
import flash.events.*;
import flash.display.Loader;
import flash.display.LoaderInfo;
import flash.net.URLLoader;
import flash.net.URLRequest;

var url:String = "http://domain.com/image.png";
var myLoader:Loader;
myLoader= new Loader();
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
myLoader.load(new URLRequest(url));

function onProgress(e:ProgressEvent):void
{
var p:Number = (e.bytesLoaded / e.bytesTotal);
}
function onComplete(e:Event):void
{
myLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
//e.target.content.bitmapData
stage.addChild(myLoader);
}

Initial URL

                                

Initial Description

                                

Initial Title
AS3: Image load

Initial Tags

                                

Initial Language
ActionScript 3