A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Linking an invisible button to a url

  1. #1
    Junior Member
    Join Date
    Feb 2009
    Posts
    3

    Linking an invisible button to a url

    Hey Everyone!

    I am having a problem linking an invisible button to a url. I have 3 invisible buttons that have an action script as follows:

    button1.addEventListener(MouseEvent.CLICK,clickHan dler1);
    button2.addEventListener(MouseEvent.CLICK,clickHan dler2);
    button3.addEventListener(MouseEvent.CLICK,clickHan dler3);
    function clickHandler1(event:MouseEvent):void{
    navigateToURL(new URLRequest("http://mywebsite.com"));
    }
    function clickHandler2(event:MouseEvent):void{
    navigateToURL(new URLRequest("http://mywebsite.com"));
    }
    function clickHandler3(event:MouseEvent):void{
    navigateToURL(new URLRequest("http://mywebsite.com"));
    }


    After I upload the files, I can see the hand icon when I mouse over them, but when I click on that spot nothing happens. I have two text links on the same page that do work. One is an email link and the other is a url link. So I don't think it has anything to do with the page. Is my code wrong somewhere? I have check the button names to my code and they do match.
    Any suggestions?

  2. #2
    AS3 Mod
    Join Date
    Sep 2007
    Location
    O-H-I-O
    Posts
    2,385
    This works fine for me:
    PHP Code:
    button1.addEventListener(MouseEvent.CLICK,clickHandler1);
    button2.addEventListener(MouseEvent.CLICK,clickHandler2);
    button3.addEventListener(MouseEvent.CLICK,clickHandler3);

    function 
    clickHandler1(e:MouseEvent):void {
        
    navigateToURL(new URLRequest("http://www.google.com")); 
    }
    function 
    clickHandler2(e:MouseEvent):void {
        
    navigateToURL(new URLRequest("http://www.google.com")); 
    }
    function 
    clickHandler3(e:MouseEvent):void {
        
    navigateToURL(new URLRequest("http://www.google.com")); 


  3. #3
    Junior Member
    Join Date
    Feb 2009
    Posts
    3
    Still didn't work. Weird.

  4. #4

  5. #5
    Junior Member
    Join Date
    Feb 2009
    Posts
    3
    Here's my fla.

    Thanks for taking a look at it!

    Link
    Last edited by mallenwsp1; 03-18-2009 at 05:07 PM. Reason: didn't put link in correctly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center