1

Loader を使用して外部の swf ファイルをロードし、固定次元のスプライト オブジェクトのように固定領域に表示しようとしました。そして、swf ファイルの正確なサイズはわかりません。固定領域に収まるようにしたいだけです。それは可能ですか?

コード:

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);
}

swfをパネルの領域に合わせたいです。これどうやってするの?

4

2 に答える 2

0

loaderInfo.content.height試してみる代わりにloaderInfo.loader.height

これでもうまくいかない場合は、次のことを試してください。

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

... Event.COMPLETE リスナーで。

于 2009-11-17T12:07:08.557 に答える
0
addChild(loader); //you can add it, as it is kind of proxy display object container
function completeHandler(e:Event):void { 
  loader.width = 300; 
  loader.height = 300; 
  loader.x = 0; 
  loader.y = 0;
}
于 2009-11-17T12:09:24.643 に答える