# XML gallery swf playblack/preload problem - what's going on?

**URL:** https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933
**Category:** flash
**Created:** [March 22, 2006, 3:48pm UTC](https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933 "2006-03-22T15:48:33Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![frez](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@frez](https://forum.kirupa.com/u/frez)
#### Post date: [March 22, 2006, 3:48pm UTC](https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933/1 "2006-03-22T15:48:33Z")

</div>

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 code 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 happening since fading (see code below) should only begin after 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:

```auto

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;
                }                
            }            
        }           
    }
};

```

---

<div class="post-metadata">

### Author: ![gvozden](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gvozden/32/1084_2.png) [@gvozden](https://forum.kirupa.com/u/gvozden)
#### Post date: [March 22, 2006, 5:59pm UTC](https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933/2 "2006-03-22T17:59:48Z")

</div>

I have pretty much similar problem in preloading with Opera, Firefox  
but in Explorer it works almost fine 🙂

---

<div class="post-metadata">

### Author: ![frez](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@frez](https://forum.kirupa.com/u/frez)
#### Post date: [March 23, 2006, 12:47am UTC](https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933/3 "2006-03-23T00:47:19Z")

</div>

So … might this be a problem with flash player then? I’ve seen websites that preload the way I describe above - are they using a different preloading method?

---

<div class="post-metadata">

### Author: ![frez](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@frez](https://forum.kirupa.com/u/frez)
#### Post date: [March 24, 2006, 2:37am UTC](https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933/4 "2006-03-24T02:37:45Z")

</div>

Anyone?

---

<div class="post-metadata">

### Author: ![frez](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@frez](https://forum.kirupa.com/u/frez)
#### Post date: [March 24, 2006, 8:37am UTC](https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933/5 "2006-03-24T08:37:14Z")

</div>

OK … i just got access to a PC and the exact same problem is happening there. So at least that rules out my Mac. I’m anxious to get the gallery up and running - is there anyone with info on this problem?

---

<div class="post-metadata">

### Author: ![frez](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@frez](https://forum.kirupa.com/u/frez)
#### Post date: [March 25, 2006, 12:27pm UTC](https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933/6 "2006-03-25T12:27:57Z")

</div>

bump

---

<div class="post-metadata">

### Author: ![frez](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@frez](https://forum.kirupa.com/u/frez)
#### Post date: [March 27, 2006, 10:42am UTC](https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933/7 "2006-03-27T10:42:29Z")

</div>

one last bump

---

<div class="post-metadata">

### Author: ![frez](https://avatars.discourse-cdn.com/v4/letter/f/bbe5ce/32.png) [@frez](https://forum.kirupa.com/u/frez)
#### Post date: [March 30, 2006, 9:40am UTC](https://forum.kirupa.com/t/xml-gallery-swf-playblack-preload-problem-whats-going-on/182933/8 "2006-03-30T09:40:42Z")

</div>

ok i lied - one more bump 🙂
