如何更改 Actionscript 项目中的外部 swf 尺寸?
我使用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 适合面板的区域。我该怎么做?
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 don't 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. How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用
loaderInfo.loader.height
代替loaderInfo.content.height
。如果这仍然不适合您,请尝试以下操作:
...在您的 Event.COMPLETE 侦听器中。
Instead of
loaderInfo.content.height
tryloaderInfo.loader.height
.If this still doesn't work for you, try this:
...in your Event.COMPLETE listener.