Copy link to clipboard
Copied
[ moved from AS1/2 forum ]
Hi every one,
I'm testing the new capabilities on Flash Pro CS6. And I'm stuck around here as most of my coding are AS1 / AS2 and when I try to make the coding for AS3 one part of my pre-loading is not functional any more. Basically the Dynamic Text does not shows up. Maybe if you take a look into my code you can tell me where I'm wrong.
This is the new AS3 code for my preload scene. I have created this stage to load just one image on the 2nd frame. And it works except for the text that it does not displays the text inside the following instances: percent_txt, ofBytes_txt and totalBytes_txt
I appreciate any ideas you may provide to me pls.
stop();
addEventListener(Event.ENTER_FRAME, loaderF);
function loaderF(e:Event):void{
var toLoad:Number = loaderInfo.bytesTotal;
var loaded:Number = loaderInfo.bytesLoaded;
var total:Number = loaded/toLoad;
if(loaded == toLoad) {
removeEventListener(Event.ENTER_FRAME, loaderF);
gotoAndStop(2);
} else {
preloader_mc.preloaderFill_mc.scaleX = total;
preloader_mc.percent_txt.text = Math.floor(total*100)+ "%";
preloader_mc.ofBytes_txt.text = loaded + "bytes";
preloader_mc.totalBytes_txt.text = toLoad + "bytes";
}
}
This is the result when testing,

Thank you so much and kind regards !!
Joel.
First, make sure you either embed font into the text field or use device font. Looks like this is a font embedding issue.
Copy link to clipboard
Copied
You have to set the values initally
stop();
addEventListener(Event.ENTER_FRAME, loaderF);
function loaderF(e:Event):void{
var toLoad:Number = loaderInfo.bytesTotal;
var loaded:Number = loaderInfo.bytesLoaded;
var total:Number = loaded/toLoad;
preloader_mc.preloaderFill_mc.scaleX = total;
preloader_mc.percent_txt.text = Math.floor(total*100)+ "%";
preloader_mc.ofBytes_txt.text = loaded + "bytes";
preloader_mc.totalBytes_txt.text = toLoad + "bytes";
if(loaded == toLoad) {
removeEventListener(Event.ENTER_FRAME, loaderF);
gotoAndStop(2);
}
}
what you original code was saying was after all the info was loaded to then set the text to the variables listed, you have to set it first and once the info is finally loaded go to the second frame.
Copy link to clipboard
Copied
Hi Andjelkovich2012,
I tried the code you inserted before and I still got the same result. The loader image started to move but the text about the percentage and the bytes are not displayed.
Tried to recreate the Text Instances again and to rename them also without success. (I set all Text in black so it cannot be mixed with the white background).
I can send to you my .FLA file so you can check it out.
Please let me know.
Kind Regards.
Copy link to clipboard
Copied
yeah go ahead and send the .fla that way I can check out your objects. It could be something simple as having the dynamic text set to multi-line, white text, or object name/variable problems. Also it wouldn't be a bad idea to trace out your variables and see what info you're getting, as well as seeing what section in your if statement.
Copy link to clipboard
Copied
Hi,
This is the link to my .Fla file.
https://www.dropbox.com/s/sxyyczdn5jlcgfg/preloader.fla
If the file is not available or if you have any issue at all to download please let me know.
Thanks again and kind regards.
Joel
Copy link to clipboard
Copied
First, make sure you either embed font into the text field or use device font. Looks like this is a font embedding issue.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more