Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

AS2 / AS3 Flash Preloader issue.

New Here ,
Oct 08, 2012 Oct 08, 2012

[ 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,

Preloader.jpg

Thank you so much and kind regards !!

Joel.

TOPICS
ActionScript
2.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Oct 14, 2012 Oct 14, 2012

First, make sure you either embed font into the text field or use device font. Looks like this is a font embedding issue.

Translate
Explorer ,
Oct 08, 2012 Oct 08, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 12, 2012 Oct 12, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 12, 2012 Oct 12, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2012 Oct 14, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 14, 2012 Oct 14, 2012
LATEST

First, make sure you either embed font into the text field or use device font. Looks like this is a font embedding issue.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines