如何指定外部 swf 的高度和宽度? AS3
我想将外部 swf 文件加载到我的项目中。我的项目比我加载的项目小得多,我需要使外部 swf 文件更小以适应。每当我添加 myLoader.width 和 myLoader.height 时,项目就看不到。如果我去掉 myLoader.width 和 myLoader,该项目将加载正常,但它太大了。
这是我的代码,
stop();
home_btn.addEventListener(MouseEvent.CLICK, ClickButton2);
calm_btn.addEventListener(MouseEvent.CLICK, ClickButton2);
linden_btn.addEventListener(MouseEvent.CLICK, ClickButton2);
moving_btn.addEventListener(MouseEvent.CLICK, ClickButton2);
var myLoader:Loader=new Loader();
var xPos:Number = 45;
var yPos:Number = 85;
function ClickButton2(Event:MouseEvent):void
{
if(Event.target==home_btn)
{
gotoAndStop("home");
}
else if(Event.target==calm_btn)
{
gotoAndStop("calm");
var myURL:URLRequest=new URLRequest("Project 2 Scott Parker FINAL.swf");
myLoader.load(myURL);
myLoader.x = xPos;
myLoader.y = yPos;
myLoader.width = 100;
myLoader.height = 100;
addChild(myLoader);
}
谢谢
I want to load an external swf file into my project. My project is much smaller than the project I am loading in and I need to make the external swf file smaller to fit. Whenever I added the myLoader.width and myLoader.height the project cannot be seen. If I take it away the myLoader.width and myLoader, the project will load fine but it is too big.
here is my code,
stop();
home_btn.addEventListener(MouseEvent.CLICK, ClickButton2);
calm_btn.addEventListener(MouseEvent.CLICK, ClickButton2);
linden_btn.addEventListener(MouseEvent.CLICK, ClickButton2);
moving_btn.addEventListener(MouseEvent.CLICK, ClickButton2);
var myLoader:Loader=new Loader();
var xPos:Number = 45;
var yPos:Number = 85;
function ClickButton2(Event:MouseEvent):void
{
if(Event.target==home_btn)
{
gotoAndStop("home");
}
else if(Event.target==calm_btn)
{
gotoAndStop("calm");
var myURL:URLRequest=new URLRequest("Project 2 Scott Parker FINAL.swf");
myLoader.load(myURL);
myLoader.x = xPos;
myLoader.y = yPos;
myLoader.width = 100;
myLoader.height = 100;
addChild(myLoader);
}
thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你想要 myLoader.content.width = 100;
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3 /flash/display/Loader.html
*编辑
I think you want myLoader.content.width = 100;
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html
*edit