ActionScript 3 AS3履带式装载机进展

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 AS3履带式装载机进展相关的知识,希望对你有一定的参考价值。

import flash.display.Loader;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.events.IOErrorEvent;

var myLoader = new Loader();

myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
myLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);

myLoader.load(new URLRequest("swfToLoad.swf"));

function onProgress(evt:ProgressEvent):void {
	var nPercent:Number = Math.round((evt.bytesLoaded / evt.bytesTotal) * 100);
	loadingAnim.bar.scaleX = nPercent / 100;
	loadingAnim.percLoaded.text = nPercent.toString() + "%";
}

function onComplete(evt:Event):void {
	myLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
	myLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onComplete);
	addChild(myLoader);
}

function onIOError(evt:IOErrorEvent):void {
	trace("IOError loading SWF");
}

以上是关于ActionScript 3 AS3履带式装载机进展的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 AS3装载机垃圾收集

ActionScript 3 装载机

ActionScript 3 flashvars装载机

ActionScript 3 装载机政策标志

ActionScript 3 装载机类

ActionScript 3 装载机