Open external swf from within another external swf?
Copy link to clipboard
Copied
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>
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi,
I found this function and it works correctly; however, it seems to automatically move the movie to the next frame instead of staying on the same frame in which the function is displayed.
The first function is to move to the next frame when the user presses the Tab key on their keyboard.
stage.addEventListener(KeyboardEvent.KEY_DOWN, cool);
function cool(e:KeyboardEvent):void {
if(e.keyCode == Keyboard.TAB){
gotoAndPlay("7");
}
}
This function is to open an external swf in a sizeable window with no Internet window - it works great! However, it automatically navigates the parent movie clip to frame #7. What am I doing wrong?
query_btn.addEventListener(MouseEvent.CLICK, MYBUTTON_link8);
function MYBUTTON_link8(e:MouseEvent):void
{
//navigateToURL(new URLRequest("icb.swf"), "_blank", "scrollbars=no,titlebar=no,toolbar=no,menubar=no,resizable=yes,width=1024,height=710");
var gameURL:String = "http://opstraining.bcbsfl.com/NonPMI/RBMS/icb.swf";
var jscommand:String = "window.open('"+gameURL+"','win','width=1024,height=710,toolbar=no,scrollbars=no,location=no,status=no,menubar=no');";
var url:URLRequest = new URLRequest("javascript:" + jscommand + " void(0);");
navigateToURL(url, "_self");
}
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Without seeing the whole movie, I can't begin to tell you where the problem might be. Is the movie stopped when this new window is opened? Can you insert a stop(); directive to hold the playback head on that frame?
Copy link to clipboard
Copied
try this and let me know if you can see my fla files:
Copy link to clipboard
Copied
No luck, neither of those links worked. Send me a private message and I'll send you an address to send an email with an attachment.
Copy link to clipboard
Copied
I tried to send you a private message. The problem is that one of the file sizes is over 10MB and my corporate firewall may not allow me to e-mail the file. I know that I have a 10MB max. Any ideas? I tried to upload a file her bue couldn't find out how to do it.
Copy link to clipboard
Copied
Send me a private message. I will reply with an address that you can upload the file to.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Try to send the file through my upload page again. I changed the maximum file size.

