2 Replies Latest reply on May 27, 2009 6:38 PM by billygoatkaraoke

    Hyperlink button - where do I put the code?

    billygoatkaraoke Level 1

      Hi

       

      I'm using Actionscript 3 in CS4

       

      I want to add a hyperlink link button to my site, but it keeps buggering up the flow.

       

      Here's is the code for my site so far (minus the link code):

       

      ---------------------------

      stop();
      function trans(event:MouseEvent):void{
          gotoAndPlay(event.target.name);

      }

       

      karaoke.addEventListener(MouseEvent.CLICK,trans);
      trivia.addEventListener(MouseEvent.CLICK,trans);
      gilbert.addEventListener(MouseEvent.CLICK,trans;

      ----------------------------

       

       

      So there are three menu buttons, and the page flys in animations depending on the button pushed.

       

      I have another button named LINK, and I thought it would just be a matter of inserting the following code somewhere:

       

      LINK.onRelease=function(){
      getURL("http://www.gilbert.net.au");
      }

       

      But no matter where I put it, it just makes my site play through all the animations one after the other regardless of whether buttons have been clicked or not, and the link won't work.

       

      Where should I put this code and is it correct?

       

      Also, once it's working, I want to copy it and make another button for creating an email.  Is that just a matter of having a mailto: link instead of a hyperlink?

       

      Cheers for your help.

       

      Shaun