Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9018365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:30:31+00:00 2026-06-16T04:30:31+00:00

I’m using Flash CS5 and FlashDevelop to build a game in ActionScript 3. I’m

  • 0

I’m using Flash CS5 and FlashDevelop to build a game in ActionScript 3.
I’m trying to have the game as much datadriven as possible. So most of the game information is stored in XML files that are loaded when required by the game.

This loading works fine, but as it happened some files have become rather big so that loading can take a number of seconds (~3 at the moment on my PC, but I expect it to become even longer). So I wanted to add a loading screen with progress information (at the very least a bar with percentage).

The later part is the one that confuses me. Here’s the code where I ask for the XML file to be loaded:

public function load( a_FileName:String, a_Callback:Function, a_LoadingScreen:MovieClip ):void
{
    m_Callback = a_Callback;

    m_LoadingScreen = a_LoadingScreen;

    var t_URLLoader:URLLoader = new URLLoader();

    t_URLLoader.addEventListener( Event.COMPLETE, fileLoadComplete );
    t_URLLoader.addEventListener( ProgressEvent.PROGRESS, fileLoadProgress );


    t_URLLoader.load( new URLRequest( a_FileName ) );

}

The following code shoudl be called on each ProgressEvent.PROGRESS

public function fileLoadProgress( e:ProgressEvent ):void 
{
    m_LoadingScreen.txtPercentage.text = Math.floor( ( e.bytesLoaded / e.bytesTotal ) * 100 ) + "%";


}

The problem is that my program seems to load the file first (not doing anything else while its busy) and only then shows the loading screen.

If I put a trace in the fileLoadProgress function I do get a number of updates in my output window, but the screen does not update.

When using MouseEvents I know you can use the updateAfterEvent() function to force a draw call, but this method doesn’t seem available to me when using ProgressEvents.

Any way to force my screen to update while loading the xml file?

—EDIT—-

I made a small sandbox to further test this problem: A single FLA file with just a dynamic textfield on frame one and the following code:

var t_URLLoader:URLLoader = new URLLoader();

t_URLLoader.addEventListener( Event.COMPLETE, fileLoadComplete );
t_URLLoader.addEventListener( ProgressEvent.PROGRESS, fileLoadProgress );

t_URLLoader.load( new URLRequest( "data/TerritoryData.xml" ) );

stop();

function fileLoadProgress( e:ProgressEvent ):void 
{
    trace( Math.floor( ( e.bytesLoaded / e.bytesTotal ) * 100 ) + "%" );
    txtPercentage.text = Math.floor( ( e.bytesLoaded / e.bytesTotal ) * 100 ) + "%";
}

function fileLoadComplete( a_Event:Event ):void
{
    trace( "done!" );
    txtPercentage.text = "done!";
}

This is about as bear bones as I can make it, but it still shows the same problem. In my output window the traces show:

28%
56%
84%
100%
done!

but in the screen it goes from blank to “done”. If I put breakpoints in fileLoadProgress function the screen doesn’t update either. If I Close() the URLLoader in the fileLoadProgress function it does end up with a “28%” text.

Any ideas? This is driving me nuts…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:30:32+00:00Added an answer on June 16, 2026 at 4:30 am

    As Dave Hart mentioned in the comment on the original question. The answer is that Flash will not update the screen unless the xml file is loaded is from an external website.

    With the XML on my website, the game would show one or two updates in the textfield, with the screen updates stalling in between (I used a simple animation in the background to keep track of the framerate). This is still not by far the amount of trace outputs I receive in the debug window, but at least it shows that it can indeed output stuff to the screen with an update about once every second.

    Also the first time I tried it, it seemed to work better than subsequent times, but this is perhaps due to the file being stored locally temporarily?

    Unfortunately it’s of zero use to me as my files are going to be loaded locally. So I guess I’ll have to live with loading screens that have no animation whatsoever.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a text area in my form which accepts all possible characters from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have thousands of HTML files to process using Groovy/Java and I need to
I have a view passing on information from a database: def serve_article(request, id): served_article
I am trying to loop through a bunch of documents I have to put
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.