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);
}
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();
where is fla source file.. i would like to test with ur fla source file. Can u upload in this website this script source file?
ReplyDeletethanks.
Mohammad Raihan Mazumder
Jakarta, Indonesia
@Raihan... First of all thanks for stopping by. I think there's no sense of publishing a source file, since this is the source code, just copy and past to an empty keyframe in the timeline. If you're talking about this code in a class, in pretty much the same thing, just give it the class structure and place the methods private or public... as far as I can see you knew how to do it already, in your website. The difference is that this gives you the percentage of loading in case you want a preloader. Cheers
ReplyDelete