views:

226

answers:

2

Hi I used Loader to load an external swf file, and try to display it in a fixed area, like a fixed dimention sprite object. And I dont know the exact size of the swf file, I just want it to fit the fixed area. Is that possible?

code:

var loader:Loader = new Loader(); loader.load(new URLRequest("some path")); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler); function completeHandler(e:Event):void { var loaderinfo:LoaderInfo = event.target as LoaderInfo; loaderinfo.content.width = 300; loaderinfo.content.height = 300; loaderinfo.content.x = 0; loaderinfo.content.y = 0;//note that this works for displaying picture, but not for swf thePanel.stage.addChild(loader); }

I want the swf to fit the panel's area, so how should I do?

A: 

Instead of loaderInfo.content.height try loaderInfo.loader.height.

If this still doesn't work for you, try this:

var container:Sprite = new Sprite();
container.addChlid(loaderInfo.loader);
container.width = 300;
container.height = 300;
thePanel.addChild(container)

...in your Event.COMPLETE listener.

Cory Petosky
still not work, so I doubt that if it's an impossible mission.Or we cannot use conventional weapon for this...
A: 
bhups
I tried, not work