SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
-
Jul 30, 2003, 04:39 #1
loading a javascript variable into a flash movie embed code in html
Hi Chaps
Hold tight, here's my problem and i'd welcome any suggestions!
I'm determining the screen resolution of users in javascript. Depending upon what resolution they have, the dimensions of the resulting flash movie I want them to view will be different.
I have 2 javascript variables flashWidth and flashHeight. I need them to be embedded into the html file where it specifies the flash movie properties:
Code:WIDTH="flashWidth Variable" HEIGHT="flashHeight Variable"
Any suggestions would be most welcome.
Cheers
-
Jul 30, 2003, 06:01 #2
- Join Date
- Jul 2003
- Location
- Moncton, New Brunswick, Canada
- Posts
- 247
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Gooday,
Your on the right track. Just docwrite the whole tag wherever you want in your html. Whenever I put flash in any pages, I always write out all the flash tags with javascript anyway since that is the only way for my xhtml to validate in strict mode.
Code:<script type="text/javascript"> //<![CDATA[ var fStr = ""; fStr += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/' + 'flash/swflash.cab#version=6,0,0,0"' + 'width="'+flashWidth+'" height="'+flashHeight+'" id="pept" align="">' + '<param name=movie value="pept.swf"> ' + '<param name="WMode" value="Transparent">' + '<param name="quality" value="high">' + '<param name="bgcolor" value="#ffffff">' + '<embed src="pept.swf" quality="high" bgcolor="#ffffff" ' + ' width="'+flashWidth+'" height="'+flashHeight+'" name="pept" align="" ' + 'type="application/x-shockwave-flash" ' + 'pluginspace="http://www.macromedia.com/go/getflashplayer">' + '</embed></object>'; document.write(fStr); //]]> </script>
Bookmarks