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

  • SEARCH
  • Home
  • 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 4041006
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:49:32+00:00 2026-05-20T12:49:32+00:00

So the following code is Lee’s implementation of a preloader which works fine first

  • 0

So the following code is Lee’s implementation of a preloader which works fine first load but goes crazy when the browser loads a cached file, jumping from 0% to 100% randomly

Things I have tried to no avail:

  • switching off gzip compression, tho I dont think it is on
  • Using ENTER_FRAME instead of progress
    and complete

        l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
        l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
        l.load(new URLRequest("http://www.foo.com/foo.swf"));
    
        function loop(e:ProgressEvent):void
        {
            perc = Math.round(e.bytesLoaded / e.bytesTotal * 100);
            lt.text = String(perc);
            if (perc >= 100)
                l.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, loop);
        }
    
        function done(e:Event):void
        {
            l.contentLoaderInfo.removeEventListener(Event.COMPLETE, done);
            addChild(l);
        }
    

I do not believe I am loading it more than once:

public function Main():void 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);  
        }

        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            Security.allowDomain("http://www.foo.com");
            preLoader();
        }
  • 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-05-20T12:49:32+00:00Added an answer on May 20, 2026 at 12:49 pm

    I discovered the problem happens because the files are hosted on an addon domain.

    To fix this I changed the url to reference the main domain:

    from

    l.load(new URLRequest("http://www.foo.com/foo.swf"))
    

    to

    l.load(new URLRequest("http://foo.maindomain.com/foo.swf"))
    

    and also add

    Security.allowDomain("http://foo.maindomain.com");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code works fine in FF and Chrome, but not in IE8. I
The following code works fine with python.exe but fails with pythonw.exe. I'm using Python
The following code works great in IE, but not in FF or Safari. I
Following code works in debug mode, but in release mode there are only blank
The following code compiles and runs fine with gcc. But i wondered if such
The following code doesn't compile with gcc, but does with Visual Studio: template <typename
The following code illustrates an object literal being assigned, but with no semicolon afterwards:
The following code has a simple binding which binds the Text of the TextBlock
I have the following PHP code, but it's not working. I don't see any
Following code will compile but crash at run time: int main() { try {

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.