Return to Snippet

Revision: 12749
at June 23, 2009 10:31 by mrbassman12


Updated Code
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;

function startLoad()
{
	var mLoader:Loader = new Loader();
	var mRequest:URLRequest = new URLRequest("MouseActions.swf");
	mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
	mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
        mLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
	mLoader.load(mRequest);
}

function onCompleteHandler(loadEvent:Event)
{
        addChild(loadEvent.currentTarget.content);
}
private function errorHandler(errorEvent:Event):void {
	trace("file not found")
}
function onProgressHandler(mProgress:ProgressEvent)
{
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
}
startLoad();

Revision: 12748
at March 26, 2009 11:18 by mrbassman12


Initial Code
import flash.net.URLRequest;
import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;

function startLoad()
{
	var mLoader:Loader = new Loader();
	var mRequest:URLRequest = new URLRequest(“MouseActions.swf”);
	mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
	mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
	mLoader.load(mRequest);
}

function onCompleteHandler(loadEvent:Event)
{
        addChild(loadEvent.currentTarget.content);
}
function onProgressHandler(mProgress:ProgressEvent)
{
var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
trace(percent);
}
startLoad();

Initial URL

                                

Initial Description

                                

Initial Title
Load external swf with loader class

Initial Tags

                                

Initial Language
ActionScript 3