[SWFObject] swfobject_jskit only works in FF on reload
Geoff Stearns
geoff at deconcept.com
Tue Oct 31 10:56:23 PST 2006
sounds like the swf isn't loaded yet when you try to send the data
into it...
you should be waiting until the swf is fully loaded and initialized,
*then* send the data into it.
but you could also just as easily send in the initial size as a
flashvar instead of sending it in with the js kit, then just send in
the onresize values with the js kit.
On Oct 31, 2006, at 12:31 PM, David Waclo wrote:
> Hello,
>
> I'm not sure if the problem I'm having is with how I'm using the
> the
> swfobject_jskit or with the way I have my javascript written:
>
> http://wolfsmithmedia.com/TestDave/webN.php
>
> The green box should display the width of the of the page. It
> works fine
> in IE on windows, but on FireFox in Windows it usually doesn't
> work. If I
> reload the page several times, it eventually will work. On Firefox
> for a
> Mac, it doesn't work the first time, but always works if I reload
> the page.
> The only thing I can think is that its some kind of timing thing
> with the
> order the files are loaded.
> The width of the window is read by the javascript and sent to the
> swf via
> the swfobject gateway when the window is resized. That width is then
> displayed with the displayData function in the swf exactly as in
> Geoff's
> example in the kit.
> Any help would be greatly appreciated as I've already spent a lot
> of time
> trying to figure this out. I also realize I could use the External
> Interface
> in Flash 8, but we're trying to avoid forcing people to upgrade.
>
> Here is the javascript:
>
> <script language="JavaScript">
>
> // tells function to do only once for IE and Opera
> var doneYet = false;
> // event occurs when window is resized
> window.onresize = resizer;
>
> // IE, Opera, Safari trip onresize continuously as mouse is
> pressed, so
> function is set to do once a second
> function resizer() {
> if (!doneYet) {
> setTimeout('doOnce()', 1000);
> doneYet = true;
> }
> }
>
> function doOnce() {
> sendSwf();
> doneYet = false;
> }
>
> var winW = 630, winH = 460;
>
> // gets width and height of window: IE uses document.etc while
> opera, FF
> use window.etc
> function winDim() {
> if (parseInt(navigator.appVersion)>3) {
> if (navigator.appName.indexOf("Microsoft")!=-1) {
> winW = document.body.offsetWidth - 20 ;
> winH = document.body.offsetHeight - 20;
> } else {
> winW = window.innerWidth - 16;
> winH = window.innerHeight - 16;
> }
> }
> }
>
> // gets dimensions for initial loading of swf.
> winDim();
>
> // uses gateway to send winW to functions in the swf
> function sendSwf() {
> winDim();
> swf.call('displayData', winW);
> swf.call('getWidths', winW);
> }
>
> </script>
>
> <div align="center" id="flashcontent">
>
> Flash here
> </div>
> <script type="text/javascript">
> var swf = new SWFObject("webN.swf", "jsdisplay", "2000", "116",
> "6.0.65",
> "#ffffff");
> swf.setProxy(null, 'swfobject_js_gateway.swf');
> swf.addParam("quality", "high");
> swf.addParam("wmode", "transparent");
>
> // --> here I add a bunch of variables using swf.addVariable
>
> swf.write("flashcontent");
>
> sendSwf();
>
> </script>
>
> _________________________________________________________________
> Stay in touch with old friends and meet new ones with Windows Live
> Spaces
> http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?
> href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/
> friends.aspx&mkt=en-us
>
> _______________________________________________
> SWFObject mailing list
> SWFObject at lists.deconcept.com
> http://lists.deconcept.com/listinfo.cgi/swfobject-deconcept.com
More information about the Swfobject
mailing list