AS3: Stop links opening in new window
The links I have in my .swf keep opening in new windows/tabs rather than the same one, how can I make it open in the same tab? Here's my actionscript 3 script:
aquaheal.addEventListener(Mous开发者_StackOverfloweEvent.CLICK, fl_ClickToGoToWebPage_2);
function fl_ClickToGoToWebPage_2(event:MouseEvent):void {
navigateToURL(
new URLRequest("http://www.mediwales.com/index.php?id=6&member=9"), "_self");
}
Try omitting the _self
parameter from navigateToUrl
. It defaults to null
which is what I believe you want.
It appears that it is indeed _self
that you require.
Have you tried running your page on the web rather than from file? The docs say:
When code in a SWF file that is running in the local-with-filesystem sandbox calls the navigateToURL() function and specifies a custom window name for the window parameter, the window name is transfered into a random name. The name is in the form "_flashXXXXXXXX", where each X represents a random hexadecimal digit. Within the same session (until you close the containing browser window), if you call the function again and specify the same name for the window parameter, the same random string is used.
Maybe this is messing things up for you?
精彩评论