Skip to main content
MarekMularczyk
Adobe 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
Adobe 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
Adobe Expert
April 8, 2009

Just to be clear, you want it to load it in the same swf file correct?  And not a new browser window?

You would need to load it in a movieClip
Here is a sample that loads it in a movieClip, see attached file.  Hmmm, won't let me upload...try it here: http://www.smithmediafusion.com/openCloseWindowSample.fla


What I'm trying to do is creat stand-alone swf files to use on the computer (without use of web browser).

I want to be able to jump from menu to different chapters (swf files) and get back to main menu.

Because the other swf files have been created in Captivate not Flash, I don't know how to make them come back to the main menu after watching them.

Adobe Community ExpertAdobe Certified Professional