Yes. While loading a SWF using wmode=transparent, loaderInfo doesn't fire
ProgressEvent.PROGRESS and Event.COMPLETE events for itself inside FireFox.

The solution is using a separate ENTER_FRAME event to check on the loading
state. You can read the bytesLoaded and bytesTotal (they're correctly
updated), it's just the events that never fire.

This is more or less what I use with a hack event, on top of my normal
events:

        protected function startSelfLoading(): void {
            addEventListener(Event.ENTER_FRAME, onSWFLoadingProgressHack,
false, 0, true); // This is needed because Flash won't fire SWF loading
events if wmode=transparent!
            root.loaderInfo.addEventListener(ProgressEvent.PROGRESS,
onSWFLoadingProgress, false, 0, true);
            root.loaderInfo.addEventListener(Event.COMPLETE,
onSWFLoadingComplete, false, 0, true);
        }

        protected function onSWFLoadingProgress(e:ProgressEvent): void {
            swfLoadingPhase = e.bytesLoaded / e.bytesTotal;
        }

        protected function onSWFLoadingProgressHack(e:Event): void {
            // This is needed because Flash won't fire SWF loading events if
wmode=transparent!
            swfLoadingPhase = root.loaderInfo.bytesLoaded /
root.loaderInfo.bytesTotal;
            if (swfLoadingPhase >= 1) {
                // Just for safety's sake, wait a few frames after it has
finished loading
                framesAfterLoaded++;
                if (framesAfterLoaded > 5) onSWFLoadingComplete(null);
            }
        }

        protected function onSWFLoadingComplete(e:Event): void {
            swfLoadingPhase = 1;
            removeEventListener(Event.ENTER_FRAME,
onSWFLoadingProgressHack);
            root.loaderInfo.removeEventListener(ProgressEvent.PROGRESS,
onSWFLoadingProgress);
            root.loaderInfo.removeEventListener(Event.COMPLETE,
onSWFLoadingComplete);
            // Show website, etc
        }

Loading secondary SWFs seem to work normally. It's just want the firts SWF
is loading itself.

Zeh

On Thu, Nov 19, 2009 at 3:54 PM, Joe Minkiewicz <joe.min...@gmail.com>wrote:

> I run into this issue a lot (I may have even posted here before asking for
> help about it).
>
> Has anyone run into an issue with swfs randomly not loading correctly in
> FireFox on PC? I have one regular client and once in awhile they say the
> swfs don't load—it's always FF on PC, Mac and other browsers work fine.
> I've
> never been able to figure it out. It's not 100% reproducible and on my PC
> virtual machine everything's fine. The best I can come up with is to turn
> off wmode=transparent but sometimes they need that and I'm not sure it's a
> real fix.
>
> I'm wondering if it's something to do with how I code the swfs? Maybe
> something to do with the preloader code? But it could also be something
> with
> their computers since they're the ones that see it. Any ideas? I've tried
> google but everything I find is old (FF2) or the fixes don't apply to my
> situation.
>
> Thanks,
> Joe
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to