Hi. I am new to flash and have checked out a lot of tutorials. I thought I had the right code, but it will not work correctly and after trying many different things I cannot get my button to work correctly.

I have created a movie in flash and added the code below to change it into a button, my goal is, when flash button is clicked a new page opens, right now the page opens in a new window without being clicked:

box.addEventListener(MouseEvent.CLICK, buttonClickHandler);
function buttonClickHandler(event:MouseEvent):void {
    navigateToURL(new URLRequest("http://maxxsunglasses.com/products/new.html"));

trace("I'm clicked");

I don't know if putting the code into an HTMl document can be causing any issues as well. I just want this to work correctly, if there is a better way of doing this please let me know. if you need any more info just ask

Thank you so much for your help!

If you want the page to be opened in the current window rather than in a new window you can do this:

function buttonClickHandler(e:MouseEvent):void
			navigateToURL(new URLRequest("http://maxxsunglasses.com/products/new.html"), "_self");

Not sure if that's what you're after.

Other than that, the code you've posted for the click handler looks OK! I really don't see how it is opening the link without being clicked though! Unless you've put the code somewhere silly!

Cheers for now,