this is to preloading in cs3...
full code:
import flash.display.Loader;
import flash.net.URLRequest;
var url:String='http://greetings.visualenc.com/shockwave/friends3.swf?cachebusters='+new Date().getTime();
var loader:Loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.OPEN,loadinit);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,loading);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completes);
loader.load(new URLRequest(url))
addChild(loader)
function loadinit(event:Event){
trace("::::Started::::");
}
function loading(event:ProgressEvent) {
trace((event.bytesLoaded/event.bytesTotal)*100);
}
function completes(event:Event){
trace("::::complete::::")
}
import flash.display.Loader;
import flash.net.URLRequest;
This is loading the necessary packages...for loader class and url request
var url:String='http://greetings.visualenc.com/shockwave/friends3.swf?cachebusters='+new Date().getTime();
string contains the url to be loaded..
that new Date().getTime()..is not new feature. when added to url files will not be cached...or no need to clear cache for new updated file..
var loader:Loader=new Loader();
Creating Object for loader class...Loader class is to load image and swf files into flashCS3
loader.contentLoaderInfo.addEventListener(Event.OPEN,loadinit);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,loading);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,completes);
Adding listeners ..similar to MovieClipLoader in flash8.
loader.load(new URLRequest(url))
loading external content into loader object via url request class...
trace((event.bytesLoaded/event.bytesTotal)*100);
here we calculate the bytes loaded...
2 comments:
Thanks u man
testing
Post a Comment