1 Reply Latest reply on Apr 28, 2010 7:29 AM by Ned Murphy

    Link within a flash file

    Zagek34

      Hi,

      I have a flash file and I want to be able to hover over it and see the  cursor change and when I click I want to be sent to a page I specify on a  website.

      I've tried "on(release) etc" in ActionScript (although I know nothing!)  and it says I need to use NavigateToURL so I tried searching on the  Internet and couldn't find anything?

      Can anyone please help? I'll happily elaborate if necessary.

        • 1. Re: Link within a flash file
          Ned Murphy Adobe Community Professional & MVP

          If it's telling you you need to use navigateToURL, you are using Actionscript 3.  In AS3, to make a button/movieclip work with code, you need to add an event listener and event handler function for it.  You might need to add a few (for different events, like rollover, rollout, clicking it, but for now we'll just say you want to be able to click it to get a web page to open.  In the timeline that holds that button, in a separate actions layer that you create, in a frame numbered the same as where that button exists, you would add the event listener:


          btn1.addEventListener(MouseEvent.CLICK, btn1Click);

           

          The name of the unique function for processing the clicking of that button is specified at the end of the event listener assignment, so now you just have to write that function out:


          function btn1Click(evt:MouseEvent):void {

             var url:String = "http://www.awebsite.com/awebpage.html";

             var req:URLRequest = new URLRequest(url);

             navigateToURL(req);

          }