A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Click button to send to new URL

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

    Question Click button to send to new URL

    I have a simple 15 second flash animation that works fine, but I want to make an invisible button over it that when clicked opens a new URL. In other words, the cursor turns into a hand, then when the 300 x 250 pixel image is clicked, a new website comes up in a new browser tab. I assume that I will need to use a transparent layer as a button on top of the other layers. But, I am not sure how to load the code into this top transparent layer. Thanks for any help offered.

  2. #2
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    You can place the code on the main timeline, and have it reference the transparent layer. Let's say the invisible button is called 'invisiButton' and you want it to go to another page when clicked....you would have the following code in the main timeline.

    Code:
    invisiButton.onReleased = function(){
        getURL("anotherpage.html", "_self");
    }
    You would use code like
    Code:
    invisiButton.buttonMode = true
    to give it the hand cursor when the mouse if over the area.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    3
    Thanks samac1068. I actually had to dig a little further to get the hyperlink to work correctly as I am using AS3. Now, I am trying to figure out how to set up a clickTAG in the same set of commands.

  4. #4
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    You can use the eventlistener with the function in the command like this:
    Code:
    invisiButton.addEventListener(MouseEvent.CLICK, function(){getURL("anotherpage","_self")});
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

  5. #5
    Junior Member
    Join Date
    Mar 2010
    Posts
    10
    Quote Originally Posted by samac1068 View Post
    You can use the eventlistener with the function in the command like this:
    Code:
    invisiButton.addEventListener(MouseEvent.CLICK, function(){getURL("anotherpage","_self")});
    Hi, I tried doing this with a url but it said in Firefox:
    Firefox can't find the file at /G:/Webpages/A Touch of Romance/GE_CreditLine_OLA FINAL 120609/undefined

    No matter how I try to tell it to go to a url when they click on the layer it always says undefined

    Any ideas? The FLA file is attached
    Attached Files Attached Files
    Last edited by misterkode; 03-27-2010 at 02:42 AM.

  6. #6
    Flash/Flex Developer samac1068's Avatar
    Join Date
    Apr 2007
    Location
    Here, no there
    Posts
    1,813
    The only invisible button I see is called Hit and contains completely different actionscript. You have the variable clickTag at the URL, but it isn't defined anywhere. If this represents you invisible button, then you need to move your code to the correct location because the code for the invisible button is being ignored.
    Some people are like Slinkies, not really good for anything, but they bring a smile to your face when pushed down the stairs.

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