Loading different swf in the same container
Posted: Wed Jul 13, 2011 3:44 am
Hi everyone! I'm a novice with AS3 and I've a problem with some buttons.
The first button (btn1) loads an external swf clip (SWF1.swf - not made with Print2Flash) and the second one (btnA) load another clip made with Print2Flash (SWFA.swf).
I need to put all clips in the same container because I need that, when I press one button (eg. btn1), the swf loaded with the other one (SWFA.swf) is removed and only SWF1.swf is displayed.
Hope to be clear enough.
I tried this way:
First I set up a container and load an empty swf:
then setup the button (btn1) for the SWF1 clip:
The code for the btnA button is:
Pressing buttons the different SWF clips display well but the clip made with Print2Flash (SWFA.swf) is not uloaded and remains visible.
Any help? Thanks in advance.
The first button (btn1) loads an external swf clip (SWF1.swf - not made with Print2Flash) and the second one (btnA) load another clip made with Print2Flash (SWFA.swf).
I need to put all clips in the same container because I need that, when I press one button (eg. btn1), the swf loaded with the other one (SWFA.swf) is removed and only SWF1.swf is displayed.
Hope to be clear enough.
I tried this way:
First I set up a container and load an empty swf:
Code: Select all
var box:MovieClip = new MovieClip();
addChild (box);
box.x = 0;
box.y = 0;
var myLoader:Loader = new Loader();
var myURL:URLRequest = new URLRequest("emtpy.swf");
myLoader.load(myURL);
box.addChild(myLoader);
Code: Select all
btn1.addEventListener(MouseEvent.CLICK, btn1Clicked);
function btn1Clicked(event:MouseEvent):void
{
var myURL:URLRequest = new URLRequest("SWF1.swf");
myLoader.load(myURL);
}
Code: Select all
btnA.addEventListener(MouseEvent.CLICK, sds_ClickEvent);
function sds_ClickEvent(event:Event) {
import Print2Flash.*;
stage.scaleMode=StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;
var P2FDoc3:Print2FlashDoc3=new Print2FlashDoc3("SWFA.swf",0,0,600,500, this);
}
Any help? Thanks in advance.