[SWFObject] swfobject_jskit only works in FF on reload

Muzak p.ginneberge at telenet.be
Tue Oct 31 11:53:28 PST 2006


You're doing things the hard way.
You don't need any javascript to display a flash movie at 100% and respond to browser/movie resizing.
Look into the actionscript Stage class.

Try the following in a new FLA, test it and resize the window/flash movie.

Stage.scaleMode="noScale";
Stage.align="TL";
Stage.addListener(this);

function onResize(){
    trace("stage width: "+Stage.width);
    trace("stage height: "+Stage.height);
}

regards,
Muzak

----- Original Message ----- 
From: "David Waclo" <oakiedave at hotmail.com>
To: <swfobject at lists.deconcept.com>
Sent: Tuesday, October 31, 2006 6:31 PM
Subject: [SWFObject] swfobject_jskit only works in FF on reload


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





More information about the Swfobject mailing list