I have updated previous technique since firefox will still block it. Previous post left below, but this technique comes from here:
http://skovalyov.blogspot.com/2007/01/how-to-prevent-pop-up-blocking-in.html
Basically, make a call to an AS function that does this:
var url1:String = new String();
url1 = "http://www.macys.com/";
// This method of opening window gets around popup blockers
ExternalInterface.call("window.open", url1, "_blank", "");
You could also use ExternalInterface to call a javascript popup function to size the popup (the above code just opens a new window).
hope it works for ya'll...
previous post
In main Flex script tag, create this function:
// function below opens window without getting it blocked
private function openNewWindow(event:MouseEvent, url:String, winName:String, w:int, h:int, toolbar:int, location:int, directories:int, status:int, menubar:int, scrollbars:int, resizable:int):void {
var fullURL:String = "javascript:var myWin; if(!myWin || myWin.closed){myWin = window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h + ",toolbar=" + toolbar + ",location=" + location + ",directories=" + directories + ",status=" + status + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",top='+((screen.height/2)-(" + h/2 + "))+',left='+((screen.width/2)-(" + w/2 + "))+'" + "')}else{myWin.focus();};void(0);";
var u:URLRequest = new URLRequest(fullURL);
navigateToURL(u,"_self");
}
Then, use this code on a button or link to pop up the window:
<mx:Button
click="openNewWindow(event, 'http://www.adobe.com/', 'candiespop', 800, 600, 1, 1, 1, 1, 1, 1, 1);"
id="test link"
useHandCursor="true"
buttonMode="true"
mouseChildren="false" />
To determine if the new window has toolbars, menubars, etc you can set a 0 or 1 for those fields when calling the function. There are actually several ways to do this, but this one seemed easiest to manage to me.
Have fun.
http://skovalyov.blogspot.com/2007/01/how-to-prevent-pop-up-blocking-in.html
Basically, make a call to an AS function that does this:
var url1:String = new String();
url1 = "http://www.macys.com/";
// This method of opening window gets around popup blockers
ExternalInterface.call("window.open", url1, "_blank", "");
You could also use ExternalInterface to call a javascript popup function to size the popup (the above code just opens a new window).
hope it works for ya'll...
previous post
In main Flex script tag, create this function:
// function below opens window without getting it blocked
private function openNewWindow(event:MouseEvent, url:String, winName:String, w:int, h:int, toolbar:int, location:int, directories:int, status:int, menubar:int, scrollbars:int, resizable:int):void {
var fullURL:String = "javascript:var myWin; if(!myWin || myWin.closed){myWin = window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h + ",toolbar=" + toolbar + ",location=" + location + ",directories=" + directories + ",status=" + status + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",top='+((screen.height/2)-(" + h/2 + "))+',left='+((screen.width/2)-(" + w/2 + "))+'" + "')}else{myWin.focus();};void(0);";
var u:URLRequest = new URLRequest(fullURL);
navigateToURL(u,"_self");
}
Then, use this code on a button or link to pop up the window:
<mx:Button
click="openNewWindow(event, 'http://www.adobe.com/', 'candiespop', 800, 600, 1, 1, 1, 1, 1, 1, 1);"
id="test link"
useHandCursor="true"
buttonMode="true"
mouseChildren="false" />
To determine if the new window has toolbars, menubars, etc you can set a 0 or 1 for those fields when calling the function. There are actually several ways to do this, but this one seemed easiest to manage to me.
Have fun.