Thanks, Tracy -- Does that still apply even when the loaded SWF is not built with the Flex framework?
Note - I am actually not using the Flex framework at all in this project. It's
a pure AS3 application. Sorry, I forgot to mention that.
My specific code looks like this:
var request:URLRequest = new URLRequest(path);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSwfComplete, false,
0, true);
...
private function onSwfComplete(event:Event):void
{
var loaderInfo:LoaderInfo = event.target as LoaderInfo;
var loader:Loader = loaderInfo.loader;
Out.out(this, "loaderInfo ("+loaderInfo.width+", "+loaderInfo.height+")");
Out.out(this, "loader ("+loader.width+", "+loader.height+")");
checkComplete();
}
The Out.out calls are a simple trace utility - and they report:
[Out] [BootstrapTask] says, "loaderInfo (441, 331)"
[Out] [BootstrapTask] says, "loader (2252.3, 2464.8)"
Very strange to me - I've never had them report different values. But then
again, I've never tried loading an Illustrator exported SWF either..
Jonathon
From: [email protected] [mailto:[email protected]] On Behalf
Of Tracy Spratt
Sent: Monday, May 11, 2009 11:13 AM
To: [email protected]
Subject: RE: [flexcoders] Loader coming back with incorrect dimensions
There are timing issues with SWFLoader. Perhaps the loaded swf has not
completed its layout when you check the size? A loaded swf is not ready on the
loader.complete event, you must wait for the applicationComplete event.
Tracy Spratt,
Lariat Services, development services available
________________________________
From: [email protected] [mailto:[email protected]] On Behalf
Of Jonathon Stierman
Sent: Monday, May 11, 2009 11:57 AM
To: [email protected]
Subject: [flexcoders] Loader coming back with incorrect dimensions
Has anyone run across a Loader instance incorrectly reporting the width/height
of the SWF file it is loading?
Information about the application:
1. The SWF files I am loading are generated via a File>>Export command out of
Adobe Illustrator. This causes it to come out as an AVM1Movie.
2. I am loading these SWF files into an AVM2 SWF via the Loader class. Some
of them correctly give me the dimensions, and some of them do not.
3. Oddly enough, on the incorrectly sized content, the Loader's LoaderInfo
instance contains the correct dimensions.
My initial reaction was to look at the content in Illustrator and see if maybe
some vector data was being included in the SWF way offscreen (the incorrect
dimensions are always larger) - thus causing the SWF to report a larger width
than I am expecting. But I do not see any content in the Illustrator that
would do that.
I know there is some issues with loading AVM1 content into an AVM2 SWF - I
wouldn't think the dimensions would be something affected by this, but you
never know.
Anyone have any ideas on what else to look at?
Jonathon
<<inline: image001.jpg>>
<<inline: image002.jpg>>

