Intro to the problem -
With AS3 I want that when people clicks an email address, it opens their email program. Therefore I do this:
mc.addEventListener(MouseEvent.CLICK, sendEmail);
function sendEmail(e:MouseEvent):void{<br />
navigateToURL(new URLRequest("mailto:name@domainname.com"));<br />
}
The problem: Every time a user clicks the movie clip, it opens their email program. However, the browser is opening a new window as well. How can I avoid the browser from opening the new window when clicking the movie clip that has the email address?
There is a very easy answer to this. Navigate to URL will open a new browser window or do it in itself depending on how specified, if no window is open it opens one regardless. Use sendToURL
instead of navigateToURL
, I just tested and it works fine.
sendToURL(new URLRequest("mailto:name@example.com"));
sendToURL
is also a function in the flash.net package
Cheers!