Return to Snippet

Revision: 36770
at November 26, 2010 06:30 by tuffstudio


Initial Code
var loader:Loader = new Loader();
var request:URLRequest;
var percent:Number;

prelo("path_to_a_file");  //// function that starts loading passed item

function prelo(path:String):void
{
	request = new URLRequest(path);
	loader.load(request);
	addChild(loader);
	
	loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
	loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);
}

function showProgress(event:ProgressEvent):void /////////////  display progress animation
{
			percent = Math.round((event.bytesLoaded / event.bytesTotal )*100 );
	///////// if text file used
		  //PercentText.text = percent + "%";
}

function onLoaded(event:Event):void    /////////// when content is loaded
{
	/// content loaded !!!

}

Initial URL
www.tuff-studio.com

Initial Description


Initial Title
Preloader & Progress Structure

Initial Tags


Initial Language
ActionScript 3