Skip to main content
Known Participant
May 9, 2014
Question

Open external swf from within another external swf?

  • May 9, 2014
  • 1 reply
  • 1325 views

Hello, I'm relatively new to AS3 and have a problem that I'd like to see if anyone can provide a response.

I have an external swf that is opened through a web page, but the swf does not diplay in a web page, we use javascript to remove the browser, control the window size to 1024X710, no scrollbars, etc. Within that external swf I want to use a button that the user can click to open a separate external swf that is located in the same folder; however, I want it to display as the original swf (without it being displayed in an Internet browser, no scroll bars, a certain size 1024X710), etc. I've been able to find script where you can open an external web page with a certain size window; however, I find nothing regarding how to open an external swf with conditions.

Any help you can provide would be greatly appreciated!

We use this script on a web page to open the external swf:

<script language="Javascript">

  function openSWF1(cbtFile)

  {

    window.open(cbtFile,"NewWindow","toolbar=no,directories=no,menubar=no,scrollbars=yes,width=1024,height=710");

  }

</script>

We use the following html code to call the JS and open the applicable swf file:

<a href="javascript:openSWF1('CBT/AppTrng/EIP-New-Siebel.swf')">Enterprise Image Processing (EIP)</a>

This topic has been closed for replies.

1 reply

robdillon
Participating Frequently
May 9, 2014

The javascript that you're showing is just opening a new browser window without the usual chrome, that is you are turning off the default toolbar, menubar and directories. You are enabling scrollbars. You are also setting an absolute width and height for the window. a

To answer your question, you can open a new flash .swf from an existing one by loading the new .swf using a loader. Exactly how you do that will depend on whether you are using AS2 or AS3. In either case it is trivial.

If you are going to use Javascript to create a new custom window, you may want to test your user's screen to be sure that they have a screen large enough for your new window. Also be aware that you are creating a "pop-up" window. Many people have this functionality turned off in their browsers and so your new window will never appear.

Known Participant
May 12, 2014

Hi, I tried the loader but it did not open in a controlled new window:

query_btn.addEventListener(MouseEvent.CLICK, MYBUTTON_link);

function MYBUTTON_link(e:MouseEvent):void{
var request:URLRequest = new URLRequest("http://opstraining.bcbsfl.com/NonPMI/RBMS/icb.swf");
var loader:Loader = new Loader()
loader.load(request);
addChild(loader);}

where would I add the JS to control the window size, etc? It also navigated to the next frame where I wanted it to stay on the frame this function is located on.

Thanks!

Known Participant
May 12, 2014

In your first query I thought that you wanted to open a second .swf in the browser window that held the existing .swf. As you said in your previous message, that version of the function MYBUTTON_link works. Why not use that?



the problem is that it automatically moves the movie clip to the next frame, where I want it to remain on the same frame. I don't see anything in the code that tells the file to automatically advance to the next frame.