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.ad开发者_运维百科dEventListener(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
I think you want myLoader.content.width = 100;
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html
*edit
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.contentLoaderInfo.addEventListener(Event.COMPLETE, function(){
myLoader.content.width = 100;
myLoader.content.height= 100;
});
addChild(myLoader);
}
精彩评论