• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Loading external swf file in a new window

Community Expert ,
Apr 06, 2009 Apr 06, 2009

Copy link to clipboard

Copied

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

Adobe Community Expert
Adobe Certified Professional
TOPICS
ActionScript

Views

2.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 06, 2009 Apr 06, 2009

Copy link to clipboard

Copied

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);
}
);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2009 Apr 07, 2009

Copy link to clipboard

Copied

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 Expert
Adobe Certified Professional

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 07, 2009 Apr 07, 2009

Copy link to clipboard

Copied

take out this line:

myLoader.load(myURL);

I added to my code from yours.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2009 Apr 07, 2009

Copy link to clipboard

Copied

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 Expert
Adobe Certified Professional

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 07, 2009 Apr 07, 2009

Copy link to clipboard

Copied

Sorry my bad.

function movie1_1(e:MouseEvent):void

{

var myLoader =new Loader();
myLoader.load(new URLRequest("01_01_Welcome.swf"));
addChild(myLoader)

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 07, 2009 Apr 07, 2009

Copy link to clipboard

Copied

Hi Dan,

We're back to where I started....

It does load the .swf file but in the same window. Is there any way to make it load in a seperate window so people can close the window after watching it and get back to menu?

Adobe Community Expert
Adobe Certified Professional

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 07, 2009 Apr 07, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 08, 2009 Apr 08, 2009

Copy link to clipboard

Copied

LATEST

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 Expert
Adobe Certified Professional

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines