Are you trying to get the value of document.body.clientWidth before the DOM has finished loading? I believe you need to wait until the document is loaded... if the script runs in the <head> before the DOM is ready, it means the <body> doesn't even exist yet, so there's no way to get its dimensions.
You can use swfobject.addDomLoadEvent to do this:
swfobject.addDomLoadEvent(function(){
var flashvars = {};
flashvars.vW = document.body.clientWidth;
swfobject.embedSWF( ... );
});
- philip
On Wed, Jan 6, 2010 at 7:09 AM, Kit <[email protected]> wrote:
> Hi all,
>
> I have a complex task at hand. I want to embed a flash movie into a
> webpage (well I was able to do that with swfobject). Also I would like
> to read out variables in my flash-file (I also was able to do that -
> on some part.)
>
> Now what I really need is this:
> I want my browser to tell my flash-file what the window width and
> height are, so the stage can be adjusted accordingly. I don't want it
> to scale anything, I want the stage to be as big as the browser window
> is. the objects on the stage should then be placed on the stage
> according the current dimensions, but the size of these objects is
> always the same. so what I want to show: the bigger your browser, the
> more room on the stage for those objects. if the browser is small,
> those objects might overlap, but if i have a kickass resolution they
> wont.
>
> now, I tried this:
>
> flashvars.vW = document.body.clientWidth;
>
> but then my flash movie won't load anymore and on the website the
> alternative content is shown.
>
> does anyone know what the problem and hopefully the solution is?
>
> thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "SWFObject" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<swfobject%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/swfobject?hl=en.
>
>
>
>
-- You received this message because you are subscribed to the Google Groups "SWFObject" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/swfobject?hl=en.
