3

I created this banner with Flash and I need that on click it opens a web page.

I used this Actionscript 3.0 code...

link_btn.addEventListener(MouseEvent.CLICK, openurl);

function openurl(event:MouseEvent):void {
var url:URLRequest = new URLRequest("http://www.festivity.it");
navigateToURL(url, "_blank");
}

BUT it's not working!

WHYYYYY?!

I tried setting it on the timeline and also on a button, but nothing changed.

Whenever I click on the button... nothing happens, but sometimes a message opens with a security alert.

Thanks.

Chiara

chiarafes
  • 33
  • 1
  • 4
  • If you could post more of your code, I might be able to help, but did you actually add the button via an addChild(link_btn); call? EDIT: Just realized you are using Flash IDE, and not FlashBuilder, so my question might not be of much use. – Eric Bernier Oct 30 '12 at 14:38
  • There's not much info here to help with, but a common problem with links is forgetting to import flash.net.navigateToURL – Pixel Elephant Oct 30 '12 at 14:50
  • Yeyyyyy! Jason! It's working! Thanks a lot! It was just a settings problem... – chiarafes Oct 30 '12 at 14:58

2 Answers2

6

Make sure your publish settings enable network access from "local playback security":

publish-settings

Jason Sturges
  • 15,855
  • 14
  • 59
  • 80
2

I have spent hours and hours working with the action code snippets. My head was practically bleeding, trying to figure out why my simple Go-To-URL action script wasn't working. I've been using a much older version of Flash for ten years. The "local playback security" setting was the problem, and it was not mentioned in any of the Adobe forums that I visited. What a frustrating "feature".

Frank
  • 21
  • 1