What the heck is going on here?

Please help - this has been driving me nuts for two days.

After rewriting my code several different ways to figure out what’s been going on, I just discovered that when I playback an online copy of my swf file in a browser, that I get an entirely different result compared to Flash 8’s Download Simulation. The latter is playing it back correctly to what I expect, but when viewed through a web browser (Firefox, IE, Safari all on Mac OSX), I get the wrong result. I’m using the latest Flash Player as of today.

The problem seems to be related to the preloader section. My code is based on the preloader setup as in the tutorials for the XML Photo Galleries on this site.

I am alternating between loading to two picture movie clips (A & B) to create a cross fade.

What should happen:
The preloader comes up on top of the current image and should then cross fade between two images, which works perfectly in Flash8.

What happens in the browser when viewing an online swf :
It often fades the current image (all or partially) before it shows the preloader bar and then sometimes fades or cuts in the next image after the preloader bar has completed. This shouldn’t be possible since no fading should not begin until the preloader has been run and hidden.

Once all the images have been pre-loaded, the cross fading works fine in the web browser correctly as it does in Flash 8. The problem is when preloading is happening.

Here is the code:


this.onEnterFrame = function() {
    
    if (p_buffer == "A") {
           
        filesizeA = pictureA.getBytesTotal();
        loadedA   = pictureA.getBytesLoaded();

        if (loadedA != filesizeA ) {

            preload_bar._alpha = 100;
            preload_bar._xscale = 100*loadedA/filesizeA;
    
        } else {
    
            preload_bar._alpha = 0;
                
            if (pictureA._alpha<100) {
        
                pictureA._alpha += 10;
                
                if (pictureB._alpha>0) {    
                    pictureB._alpha -= 10;                    
                }
            }                
        }
        
    } else {      
        
        filesizeB = pictureB.getBytesTotal();
        loadedB   = pictureB.getBytesLoaded();
        
        if (loadedB != filesizeB ) {
            preload_bar._alpha = 100;
            preload_bar._xscale = 100*loadedB/filesizeB;    
        } else {
    
            preload_bar._alpha = 0;
               
            if (pictureB._alpha<100) {
        
                pictureB._alpha += 10;
                
                if (pictureA._alpha>0) {                    
                    pictureA._alpha -= 10;
                }                
            }            
        }           
    }
};