Results 1 to 3 of 3

Thread: Setting Flash movie width with CSS

  1. #1
    Join Date
    Feb 2005
    Norwich, UK

    Setting Flash movie width with CSS

    I'm completely stuck on this. I need to set the scale a Flash movie plays at using CSS or JavaScript. It doesn't seem to work - I seem to have to dictate the dimensions within the OBJECT and EMBED tags instead.

    Here's the code I've been trying:
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="960" height="463" id="intro_ob" align="middle">
    	<param name="allowScriptAccess" value="sameDomain" />
    	<param name="movie" value="intro.swf" />
    	<param name="quality" value="best" />
    	<param name="scale" value="noborder" />
    	<param name="bgcolor" value="#ffffff" />
    	<embed src="intro.swf" quality="best" scale="noborder" bgcolor="#ffffff" width="960" height="463" name="intro_em" id="intro_em" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    	<script type="text/javascript">
    	if (window.innerWidth > 1120) {
    		document.getElementById("intro_ob").style.width = 1098;
    		document.getElementById("intro_ob").style.height = 530;
    		document.getElementById("intro_em").style.width = 1098;
    		document.getElementById("intro_em").style.height = 530;
    Basically my client wants a site where the overall site has two different size versions - as the user arrives or the browser is resized, JavaScript picks one of two stylesheets to use that set the size for the site. All works fine, except they have now said last minute that they want a Flash movie on the intro page.

    I can't dictate the width and height tags in the OBJECT using PHP or anything, as it's the first page (and hence can't send the info regarding resolution to the server until they move into the rest of the site) (I've already looked into using Ajax and XML to send the resolution to the server on arrival - can't get it to work on IE)

    So what I need is a way of scaling the Flash movie using either JavaScript or CSS. The site is due to go live Monday and I'm still stumped - please help!
    Last edited by derekjackson; 12-11-2009 at 04:45 PM. Reason: Added code example


  2. #2
    Join Date
    Mar 2007
    Instead of loading flash using the embed tag you could load it using swfobject, that lets you set a particular size for your movie.

  3. #3
    Join Date
    Jan 2009
    Alternatively you can set the height and width to 100% in the embed codes and wrap the whole thing in a div that you can style using css or javascript.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center