Loading External SWF Files: Making Things Simple...
Hello everyone! This is my first post and I'm learning AS3 😃
I didn't know about this forum but now I hope to have the time to come hear a lot, to help and be helped!
Well, I'm trying to import some external files to my main flash file with buttons. Yes, this is a newbie question, but I'm learning... I click button 1 and content 1 is loaded, click button 2 and content 2 is loaded, and so on. So, I got two ways for doing it:
**various buttons with listeners to run the function "loadCity"
var box:MovieClip = new MovieClip();
addChild(box);
box.x=20;
box.y=20;
function loadCity (Event:MouseEvent):void {
var currentCity=Event.target.name;
var swfRequest:URLRequest=new URLRequest(currentCity+".swf");
var swfLoader:Loader = new Loader();
swfLoader.load(swfRequest);
box.addChild(swfLoader); }
import fl.transitions.Tween;
import fl.transitions.easing.*;
var box:MovieClip = new MovieClip();
addChild(box);
box.x=20;
box.y=20;
var cityLoader:Loader = new Loader();
var cityURL:URLRequest=new URLRequest("montreal.swf");
cityLoader.load(cityURL);
box.addChild(cityLoader);
**various buttons with listeners to run it's own functions, like "montreal.addEventListener(MouseEvent.CLICK, loadMontreal);"
var box:MovieClip = new MovieClip();
addChild(box);
box.x=20;
box.y=20;
function loadCity (Event:MouseEvent):void {
var currentCity=Event.target.name;
var swfRequest:URLRequest=new URLRequest(currentCity+".swf");
var swfLoader:Loader = new Loader();
swfLoader.load(swfRequest);
box.addChild(swfLoader); }