1 Reply Latest reply on Jan 11, 2009 4:16 PM by robdillon

    Button GetURL Help!

    Ronald Dezino
      I have successfully made a button in Flash.
      I followed some instructions on the Internet which told me that when someone clicked on the button, it would take them to a URL in their browser.

      This is what I typed into Actions:
      getURL(" http://www.apple.com/ipodnano");

      When I did that I got the following Script Errors:

      Scene=Scene 1, layer=Layer 1, frame=1, Line 1

      Statement must appear within on handler

      I then followed some other instructions which told me to do the following:

      On (Release)
      getURL(" http://www.apple.com/ipodnano");
      End On

      This generated even more errors!

      What is going on and how do I resolve this?


      P.S. I am new to Flash so please give simple instructions

        • 1. Re: Button GetURL Help!
          robdillon Most Valuable Participant
          You probably want to go through the tutorials that come with Flash. They will give you the basics.

          From your code it looks like you are using, or trying to use, Actionscript 2. If you are using AS2, then the function that you show would be attached directly to a button instance on the stage. However, you'll have to change it. The correct version would look like this:

          on (Release) {
          getURL(" http://www.apple.com/ipodnano");

          The first line is the event that the object will receive, in this case, when the user lets go of the mouse button. Then, there are a pair of curly braces. Everything inside these braces are the instructions for actionscript to follow.

          An alternative, and much better, method in AS2 is to give each object on the stage an instance name. Then you can refer to that object by its instance name. You can find out more about this in the online help.

          If you are using AS3, then the code that you quoted above will never work.