16 Replies Latest reply on Jun 26, 2009 12:14 PM by Mike Close

    SWFLoader - Resize loaded content

    goat_boy Level 1

      I'm loading an external swf file into my flex app.  The loaded swf seems to be taking the dimensions of the root width and height and scaling it based on those dimensions.  I have tried scaling the loaded content but that maintains the height / width ratio originally given.  Here is the code.  I added the canvas so that I could see what size the loader should be.




      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
          width="350" height="600"
          layout="absolute" creationComplete="init()">
                  import mx.controls.SWFLoader;
                  [Bindable]private var loader:SWFLoader = new SWFLoader();
                  private function init():void{
                      loader.width                 = cnv.width;
                      loader.height                 = cnv.height;
                      loader.maintainAspectRatio     = true; 
          <mx:Canvas id="cnv" width="320" height="320" backgroundColor="#FFFF00"
              horizontalScrollPolicy="off" verticalScrollPolicy="off"/>



      This image is with the maintainAspectRatio = true;



      This image is with the maintainAspectRatio = false;


      I want the player to be the same width and height as the canvas.


      This image is scaled.


      Notice it still maintanes the same width/height ratio?


      If I make the flex app to have the width and height be roughly the same then the loaded content is fine which tells me that the loaded content is determining its width/height ratio off of the root width and height.


      Please help!