Skip navigation
julien.63
Currently Being Moderated

Why a DisplayObject loaded using SWFLoader gets huge and wrong width / height values ?

Jul 29, 2012 3:08 AM

Hi,

Like I said in the title, I'm loading a swf using a SWFLoader:

 

<mx:SWFLoader source="images/mcplan.swf" id="planLoader" 
                                          scaleContent="true" 
                                          autoLoad="true" 
                                          width="740" height="614" y="0" x="20"
                                          addedToStage="planLoader_addedToStageHandler(event)" />

 

Then, in the event handler, I fetch an object in the displayList :

 

protected function planLoader_addedToStageHandler(event:Event):void
{
...
       var plan:DisplayObject = Helper.getChildByNameRecursiv("mcplan", planLoader.content as DisplayObjectContainer);
...
}

 

But at that moment, the "plan" object width and height values are respectively 5.20751715E7 and 1.95268428E7. It looks ok on the screen. But if I try to change it (for fullscreen for instance) then it just doesn't work because the size of my screen is ridiculously small compare to those values...

 

I can't understand how I could get the real values for that.

 

Any suggestion?

 
Replies
  • Currently Being Moderated
    Jul 29, 2012 9:56 PM   in reply to julien.63

    If you probably want some other event than addedToStage.  That might run when the SWFLoader is added to the stage, not the loaded SWF.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points