scriptygoddess

02 Dec, 2007

Code to make a button in Flash link to another URL

Posted by: Jennifer In: Flash

This is only just a small snippet of code and probably won't be totally helpful unless you have a fairly good idea what you're doing. I would make a full tutorial, except *I* don't have a complete understanding of what I'm doing. LOL! I know just enough in Flash to be "dangerous".

In any case, from what I can tell, in the latest version of Flash, there is a new way to make a button link to a URL. Instead of creating an action on the same layer as the button, you need to assign an instance name to your button. Then in another layer you have all the code for your buttons – similar to the following:

function gotoYahoo(event:MouseEvent):void
{
var mylink:URLRequest = new URLRequest("http://www.yahoo.com");
navigateToURL(mylink, "_self");
}
buttonInstanceName.addEventListener(MouseEvent.CLICK, gotoYahoo);

(If YOU know more about Flash, and have any corrections – they would be very welcome in the comments. I know how to do simple animations (like slideshows) and simple buttons – but beyond that I'm still in the very early learning stages)

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

1 Response to "Code to make a button in Flash link to another URL"

1 | vasim

April 8th, 2009 at 6:24 am

Avatar

I am also in learning phase and also know just simple animation. so if any one has action script good tutorial then please inform me…

thnxs….

Comment Form

Featured Sponsors


  • Curt: If anyone comes across this with similar issues I was able to sort out the pagination issues painlessly with easyCommentsPaginate from http://www.mush
  • Christopher: Yeah, it is indeed hard to do. And something remains elusive about why the pagination never worked. I tried everything I could find. Regardless, I
  • Jennifer: Hi Christopher, always hard to bug test stuff like that remotely. Sorry those didn't help. Glad you found a solution though :)

About


Advertisements