-2

Possible Duplicate:
Flex: Impossible to resize an external loaded SWF.

I´ve reformulated a previous question, sorry. I have an application where I try to load an external SWF. So, we have:

  • My application: The Stage's dimensions are 768x1280. ScaleMode = EXACT_FIT
  • External SWF: It's another application where its stage is: 800x600. ScaleMode = EXACT_FIT

I try to put the external SWF into my application, in a 320x240 Canvas container. The interesting piece of code is when the external SWF is loaded by my application:

private function onLoadedApp( evt:Event ):void{
            stage.scaleMode = StageScaleMode.EXACT_FIT;

            trace("Loading Application..");
            var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
            loaderInfo.removeEventListener( Event.COMPLETE, onLoadedApp);
            trace(loaderInfo.loader.content);
            var swfApplication:SpriteUIComponent = new SpriteUIComponent( evt.target.loader.content );

            if( SWFContainer.width < swfApplication.explicitWidth ){
                var coef:Number = SWFContainer.width/ swfApplication.explicitWidth;
                swfApplication.scaleX = coef; swfApplication.scaleY = swfApplication.scaleX;
            }       

            SWFContainer.addElement(swfApplication);}

Visual results I got:

The external SWF is loaded on the suitable position and it "seems" to have 320x240 dim. But its width is a bit cropped, since if I stretch the Flash Player I achieve to see the rest of the external swf's stage. Besides, the external SWF never is resized although I shrink/stretch the Flash Player. It always remains fixed (if I trace its dimensions, I always get 800x600, although I visually see 320x240)- If I increase the stage's width of the main application, this little clip dissapear.

Discussion:

I know the original Stage's dimensions are 800, and this is greater than the original stage of my application (768), but I think, when I do the resizing, external SWF's Stage have to be fitted in the container. It is fitted, but a part of the external SWF is not seen. It's like Flash Player remembered that the external SWF Stage's width were greater than my application's one...

Regards.

Community
  • 1
  • 1
Manel
  • 147
  • 9

0 Answers0