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

preloader for xml file and stage assets

Participant ,
Nov 13, 2008 Nov 13, 2008

Copy link to clipboard

Copied

I have a Flash app that shows a map with different regions colored depending on values in an external xml file. I also have a simple preloader that I want to appear until all the elements of the app are ready to be displayed. However, when I use the preloader, the results are the same as if I hadn't use it. My map comes up immediately with no colors, there is a pause, and then the colors come in (as calculated from the data in my xml file). Can anyone tell me what I'm doing wrong? Do I have to have code in my xml loader that tells the user what percent of the file is loaded?
TOPICS
ActionScript

Views

397

Translate

Translate

Report

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 ,
Nov 13, 2008 Nov 13, 2008

Copy link to clipboard

Copied

Not sure if there's other things wrong with the routine, but one thing to watch for is whether bytesTotal is more than zero. At the very start it may be on zero, and so would equal the bytesLoaded.

Also, you probably should remove the enterframe listener when you do the play().


Votes

Translate

Translate

Report

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
Guest
Nov 14, 2008 Nov 14, 2008

Copy link to clipboard

Copied

XML files are really small. If that is all you are loading, it should happen instantly, or close to it depending on the size. Also if you are running it on your local machine, it will load very fast unless you simulate the download.

But incase that is not the issue, your code looks incomplete, or just headed down the wrong path. You should be useing a loader class that has a series of events associated with it. Events like "PROGRESS" and "COMPLETE". These events will fire automatically when a file loads, and when a file is done loading. The Enter frame event is not meant to handle loading. I would suggest using a class like BulkLoader to handle all your loading needs.

http://code.google.com/p/bulk-loader/

Votes

Translate

Translate

Report

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
Participant ,
Nov 14, 2008 Nov 14, 2008

Copy link to clipboard

Copied

LATEST
I have ended up using this code, which works, but may be less elegant:

Votes

Translate

Translate

Report

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