title: Get the Embedded Width/Height of a Flash Player using AS3
body: <p>I'm using swfobject to embed an swf into a web page. </p>
  
  <pre><code>var params = {};
  params['movie'] = 'player.swf'; 
  params['wmode'] = 'transparent'; 
  params['bgcolor'] = 'ffffff';
  params['allowScriptAccess'] = 'always'; 
  params['allowFullScreen'] = 'true'; 
  
  var flashvars = {};
  flashvars['url'] = 'video.flv';
  flashvars['resize'] = 'fit-player';
  swfobject.embedSWF("player.swf", "video", "480", "340", "10.1.0", null, flashvars, params);
  </code></pre>
  
  <p>Which creates the following HTML (I'm testing in FF3.6, so the actual HTML may vary a bit depending on your browser, but it should be close enough):</p>
  
  <pre><code>&lt;object width="480" height="340" type="application/x-shockwave-flash" data="EmbeddedPlayer.swf" id="video" style="visibility: visible;"&gt;
      &lt;param name="wmode" value="transparent"&gt;
      &lt;param name="bgcolor" value="ffffff"&gt;
      &lt;param name="allowScriptAccess" value="always"&gt;
      &lt;param name="allowFullScreen" value="true"&gt;
      &lt;param name="flashvars" value="url=MD-Open_ProblemOne_1000k_part2.flv&amp;amp;resize=fit-player"&gt;
  &lt;/object&gt;
  </code></pre>
  
  <p>I'm trying to find a good way of getting the 'width' and 'height' attributes from within AS3. <code>stage.stageWidth</code> returns the width that was defined in CS5, stage.width returns the width of the combined dimensions/positions of its children, and <code>LoaderInfo(this.root.loaderInfo).width</code> throws the following error:</p>
  
  <pre><code>Error: Error #2099: The loading object is not sufficiently loaded to provide this information.
  </code></pre>
  
  <p>Any help would be greatly appreciated!</p>