PDA

View Full Version : F9 - basic structure from as2 to as3


jad
07-15-2006, 09:06 AM
hi all again,
probably it's early to migrate Flash projects from As2 to As3 but I would like to start thinking how with a real project. So I take one and I try to dig into the structure and code. All my projects are structured as shown in the attached picture (and according to what some flash guru says) and in the first frame there is the preloading phase built using "getBytesLoaded() - getBytesTotal() ". This kind of approach seems to be no longer true in As3. What do you belive? Some opinion or suggestions or example?

Thanks.

senocular
07-15-2006, 01:48 PM
you need to use the loaderInfo object instead
http://livedocs.macromedia.com/flex/2/langref/flash/display/DisplayObject.html#loaderInfo

jad
07-15-2006, 04:33 PM
I think to understand what you mean, use the "loaderInfo" to get the progression, but my question was a bit more generic. What I was thinking is that this As2 code:

initStage();
initClip();
function initStage():Void {
Stage.scaleMode = "noScale";
Stage.showMenu = false;
System.useCodepage = true;
}
function initClip():Void {
mainLoader_mc.mainProgress_mc.mainLoadingBar_mc._x scale = 0;
}
function onEnterFrame():Void {
var percLoaded:Number = Math.floor(getBytesLoaded()/getBytesTotal()*100);
if (percLoaded == 100) {
mainLoader_mc.mainProgress_mc.mainLoadingBar_mc._x scale = percLoaded;
mainLoader_mc.mainProgress_mc.mainLoadingText_mc.p ercLoaded.text = percLoaded;
delete (onEnterFrame);
gotoAndPlay("EndPreload");
} else {
mainLoader_mc.mainProgress_mc.mainLoadingBar_mc._x scale = percLoaded;
mainLoader_mc.mainProgress_mc.mainLoadingText_mc.p ercLoaded.text = percLoaded;
}
}
stop();

used generally for preloading timeline is useless and with it the "old" concept of timeline preloading and structure.