Skip to main content
MarekMularczyk
Community Expert
Community Expert
April 6, 2009
Question

Loading external swf file in a new window

  • April 6, 2009
  • 1 reply
  • 2805 views

Hi,

I've got a few .swf files with video tutorials I've created using Captivate 4.

I wanted to link them so I've created a main screen with menu with buttons in Flash.

I've added AS to load the external swf files but they load in the same window. How can I load these .swf files in seperate window so that you could get back to the main window after you've finished watching?

Here's my code:

stop();

var myLoader:Loader = new Loader();

button1_btn.addEventListener(MouseEvent.CLICK, movie1_1);
function movie1_1(e:MouseEvent):void
{
    var myURL:URLRequest = new URLRequest("01_01_Welcome.swf");
    myLoader.load(myURL);
    addChild(myLoader);
}

I'm also attaching screenshot with menu in flash

This topic has been closed for replies.

1 reply

April 6, 2009

Try this:

var myLoader:Loader = new Loader();
var myURL:String = "01_01_Welcome.swf";
button1_btn.addEventListener(MouseEvent.MOUSE_DOWN,function():void {
navigateToURL(new URLRequest(myURL), "_blank");
myLoader.load(myURL);
addChild(myLoader);
}
);
MarekMularczyk
Community Expert
Community Expert
April 7, 2009

Hi Dan,

I'm getting an error message:

Scene 1, Layer 'actions', Frame 27, Line 7          1067: Implicit coercion of a value of type String to an unrelated type flash.net:URLRequest.

Adobe Community ExpertAdobe Certified Professional
MarekMularczyk
Community Expert
Community Expert
April 7, 2009

take out this line:

myLoader.load(myURL);

I added to my code from yours.


I've deleted the line and now the code lookes like that:

stop();

var myLoader:Loader = new Loader();

button1_btn.addEventListener(MouseEvent.CLICK, movie1_1);
function movie1_1(e:MouseEvent):void
{
    var myURL:URLRequest = new URLRequest("01_01_Welcome.swf");
    addChild(myLoader);
}

Unfortunately, it doesn't load the .swf file when you click on the button...

Adobe Community ExpertAdobe Certified Professional