[SWFObject] SWF does not play on first load (both IE and FF)

domenics at gmail.com domenics at gmail.com
Wed Dec 20 11:26:40 PST 2006


This happens even if you use flashs publish function? Have you tried disabling the extras (version detection, etc) and using a straight embed/object to narrow things down? Does this happen on other computers? Does it happen on a local publish?

Domenic

  

-----Original Message-----
From: "Sander Kruger" <s.kruger at 3-gsp.com>
Date: Wed, 20 Dec 2006 18:46:17 
To:<swfobject at lists.deconcept.com>
Subject: [SWFObject] SWF does not play on first load (both IE and FF)

Hello,

I'm new to this list. I worked through the November and December archive but
didn't find a solution. I have a problem with my Flash app wrapper using
either SWFObject 1.5 or the Adobe wrapper:

When a Flash app is loaded for the first time, it doesn't play. The player
just shows the background color. I use Flex/AS3 and Flash Player 9. This
occurs both in IE6 and in FF1.5.0.8. If the browser finds the SWF in the
cache, no problem. But if not, it doesn't play.

Does anyone know how to make sure the application starts automatically,
every time?

Here's some more diagnostics about the problem:
To get the movie to start, I can either select 'forward' from the context
menu (FF only), select 'play' from the context menu (IE and FF) or refresh
the page (IE only).

So far I've tried:
. disabling the pre-loader
. setting the 'play' and 'loop' params
. to no avail.

I did manage to create 2 workarounds in FF, neither being a very elegant
one:
1) ------------------------------------------------------
add an alert after the so.write('flashcontent'). The code becomes:

    var so = new SWFObject("TestObject.swf", "TestObject", "100%", "600",
"9");
    so.useExpressInstall('expressinstall.swf');
    so.addParam("loop", "false");
    so.write("flashcontent");

    alert( "application is starting" );

Somehow, the alert makes the Flash movie start. confirm() works as well, but
I didn't find any less intrusive commands that do the trick.

2) ------------------------------------------------------
Add a timer to kick off the play after loading. The code looks like this:

    var so = new SWFObject("TestObject.swf", "TestObject", "100%", "600",
"9");
    so.useExpressInstall('expressinstall.swf');
    so.addParam("loop", "false");
    so.write("flashcontent");

    setTimeout( 'tryPlayFlash();', 1000 );

    function tryPlayFlash()
    {
      if (document. TestObject)
      {
        if (document. TestObject.Play)
          document. TestObject.Play();
        else
          alert('Cannot communicate with ActionScript');
      }
      else
        alert('Can\'t find the Flash movie');
    }

This is a rather bad one because it will restart the movie if it plays
correctly.

And I haven't found any of this to work in IE. If you have encountered the
same problem, please let me know if there is a workaround.

Regards,
S. Kruger

_______________________________________________
SWFObject mailing list
SWFObject at lists.deconcept.com
http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com


More information about the Swfobject mailing list