Question

In my FLV file the first frame I have this pre-loader code:

//Stop Frame
stop();

//Create a listener to call the loading function as the movie loads
this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, loading);

//Runs when the loading progress has changed
    function loading(event:ProgressEvent):void
    {

    //Determine the percent loaded from bytesLoaded and bytesTotal
    var percent:Number = event.bytesLoaded / event.bytesTotal * 100;

    //Display the percentage of the pre-loaded MovieClip
    percentage_text.text = int(percent)+"%";

        if(percent == 100){
            gotoAndStop(2);
        }
    }

When I try to run the SWF file from an Xampp server via an absolute path "http://localhost/test/mainFLV.swf" the SWF does not progress past 0%. However, when I embed the SWF in a PHP script and the load that PHP script, the SWF loads, but it does not show the pre-loader progressing.

Any help?

EDIT

just tested it in Firefox, and I get a flash of the pre-loader being at 62% before it goes to the second frame. However the original problem persists in Chrome.

Was it helpful?

Solution

When you test it on a localhost the PROGRESS event fires quite often, too often, so sometimes it goes undetected. This happens if the file has been cached by the browser, too.

You should listen for event COMPLETE to decide whether the file has loaded or not.

EDIT

You can upload the file onto a slow server ;-) Or, for testing purposes, use network speed throttling software.

But honestly, if the preloader goes too fast in normal conditions (on average speed connection) that means that it is not needed. User can wait a second or two... You can use a 'spinning thing' instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top