onresize pereserve aspect ratio of embeded flash

Discussion in 'JavaScript' started by chopficaro, Mar 8, 2010.

  1. #1
    this doesnt seem to be working. im trying to determine the width of a flash object based on the height of the window onresize
    window.onresize = function()
    {
    document.getelementById("containerA").style.width=windowheight/2;
    }
    Code (markup):

     
    chopficaro, Mar 8, 2010 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    so why not set the .style.height to old height/2 as well?? or am i missing the obvious...
     
    dimitar christoff, Mar 8, 2010 IP
  3. chopficaro

    chopficaro Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    well i tried this first
    
    window.onresize = function()
    {
    document.getelementById("containerA").style.width=document.getelementById("containerA").style.height/20+'px';
    }
    Code (markup):
    heres my html if ti helps
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
      <head>
        <title>SWFObject - step 1</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    	<style type="text/css" media="screen">
    	html, body, #containerA { width:100%; height:100%; }
    	body { margin:0; padding:0;  overflow:hidden;}
    	</style>
    
    	<style type="text/javascript" src="resize.js"></style>
    
      </head>
      <body>
        <div id="containerA">
          <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%">
            <param name="movie" value="yankeeScreenMenu.swf" />
            <!--[if !IE]>-->
            <object type="application/x-shockwave-flash" data="yankeeScreenMenu.swf" width="100%" height="100%">
    	<param name="quality" value="autohigh" />
    	<param name="menu" value="false" /> 
            <!--<![endif]-->
              <p>Alternative content</p>
            <!--[if !IE]>-->
            </object>
            <!--<![endif]-->
          </object>
        </div>
      </body>
    </html>
    Code (markup):
     
    chopficaro, Mar 12, 2010 IP
  4. chopficaro

    chopficaro Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i found a solution
     
    chopficaro, Mar 14, 2010 IP
  5. inegoita

    inegoita Member

    Messages:
    54
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    48
    #5
    can you share it with us please?

    thanks, John
     
    inegoita, Mar 14, 2010 IP