Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Flash Actionscript getURL with Javascript not working

sorta in Firefox not at all in IE

6:40 pm on Jun 27, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 22, 2005
votes: 0


I am trying to get open a new browser window using getURL but I want to constrain the proportions (scale it). In Firefox it opens a new browser window at the correct width and height but it also opens an additional tab (different from the original launch tab) with my javascript in the URL address box and [object Window] written in the body of the page. This is bad.

In IE I get nothing at all. Here's the code:

on (release) {
getURL("javascript:window.open('http://www.example.com','Product Name Here','location=0,status=1,scrollbars=0,width=360,height=500', '_blank');");

I am using ActionScript 2.0

Any suggestions would be helpful and if no one has any ideas here, I will repost in the javascript section.

Thanks in advance.

10:45 pm on June 27, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

I don't think that's going to work. J.S. and Actionscript are similar, but I don't know that getURL is meant to nest Javascript. You pass URL, target, and method (post or get) to getURL.

I think you may need to dabble with fscommand. From the help manual:

fscommand function
fscommand(command:String, parameters:String) : Void

Lets the SWF file communicate with either Flash Player or the program that is hosting Flash Player, such as a web browser. ....
To use fscommand() to send a message to a scripting language such as JavaScript in a web browser, you can pass any two parameters in the command and parameters parameters. These parameters can be strings or expressions, and they are used in a JavaScript function that handles, or catches, the fscommand() function.

You use fscommand to pass the url and any other parameters to the browser and let it manage the Javascript for your sized window. Example provided in the manual:

In the web page
function myDocument_DoFSCommand(command, args) {
if (command == "messagebox") {

In Flash, add the call to fscommand to a button:

fscommand("messagebox", "Hello, " + name + ", welcome to our website!")

You should be able to alter this like so:

function myDocument_DoFSCommand(command, args) {
if (command == "mywin") {
// Always insures you have a true new window instead
// of loading into the same one if left open
var day=new Date();
var id=day.getTime();
// split args into an array
var argArray = args.split(',');
var url = argArray[0];
var params='width='+argArray[1]+',height='+argArray[2]+',scrollbars, resizable';

And in flash, something like this should pass the parameters:

fscommand("mywin", 'http://url_of_new_win_content.html,600,500');

Completely untested, but should work, according to the manual. Check out the 2.0 entry for fscommand.

1:13 pm on June 30, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 22, 2005
votes: 0

Thanks for responding Rocknbil.

Using the fscommand is a little more complicated than I wanted to try. I don't have any experience in that department and it would require that I add javascript to the HTML file. I would like to save fscommand as a last resort.

I got the impression that the javascript would work because it was one of 4 options that was listed at Adobe (Flash) here:


So that's why I was thinking that I must be doing something wrong. If you could take a look at what Adobe is saying and compare it to what I have done I would really appreciate it!

I think I will throw this question into the javascript section too.

Thanks again.