convert as3 external packgage to as3 internal
my loader external want internal . no class , package , private , public function etc. equivalent internal code loader ?
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.media.sound;
import flash.media.soundchannel;
import flash.media.soundtransform;
public class loadingmain extends movieclip {
public static const entry_frame:number = 3;
public static const document_class:string = 'main';
public function loadingmain() {
//super();
//stop();
loadingmovie.loadertext.text = 0 + "%";
loaderinfo.addeventlistener(progressevent.progress, progresshandler);
loaderinfo.addeventlistener(event.complete, completehandler);
}
private function progresshandler(event:progressevent):void {
var bytestotal = loaderinfo.bytestotal;
var bytesloaded = loaderinfo.bytesloaded;
loadingmovie.gotoandstop(math.floor(bytesloaded*100/bytestotal));
loadingmovie.loadertext.htmltext = "loading " + math.floor(bytesloaded*100/bytestotal) + "%";
loadingmovie.loadertext.autosize = textfieldautosize.center;
}
private function completehandler(event:event):void {
gotoandstop(2);
//main();
}
/*
private function main():void {
var programclass:class = loaderinfo.applicationdomain.getdefinition(loadingmain.document_class) class;
var program:sprite = new programclass() sprite;
addchild(program);
}*/
}
}
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.media.sound;
import flash.media.soundchannel;
import flash.media.soundtransform;
stop();
loadingmovie.loadertext.text = "0 %";
loadingmovie.loadertext.autosize = textfieldautosize.center;
addeventlistener(progressevent.progress, progresshandler);
addeventlistener(event.complete, completehandler);
function progresshandler(event:progressevent):void {
var bytestotal = loaderinfo.bytestotal;
var bytesloaded = loaderinfo.bytesloaded;
// loadingmovie.gotoandstop(math.floor(bytesloaded*100/bytestotal));
loadingmovie.loadertext.htmltext = "loading " + math.floor(bytesloaded*100/bytestotal) + " %";
}
function completehandler(event:event):void {
removeeventlistener(progressevent.progress, progresshandler);
removeeventlistener(event.complete, completehandler);
gotoandstop(2);
}
don't forget embed font of loadingmovie.loadertext, , type in text field don't keep empty.
More discussions in ActionScript 3
adobe
Comments
Post a Comment