3 Replies Latest reply on Nov 27, 2009 3:17 PM by kglad

    Battling with asfunction using my tiny brain - losing...

    Mister.Tibbs

      I have a movie within a flash file that contains a series of text boxes (containing existing text, not to be edited by the viewer) across the timeline.  I have all the usual buttons allowing the user to navigate between the text boxes, but I also want the text to contain hyperlinks that take the user from one text box to another across the timeline (ie, when another text box's content is referenced, the user can click that reference and jump to the relevant text box without having to click on the nav buttons).

       

      I know that this involves asfunction, but I'm more of a designer than a coder and I'm only happy performing REALLY basic functions in actionscript 2 and I'm only able to pick this stuff up when I've had it all laid bare in VERY simple terms.  For everything I've learned so far there have always been a wealth of tutorials and discussions that explain everything from the basics upwards, but every reference I've found to asfunction, thus far, has always assumed some extended knowledge of actionscript coding, which I don't have.

       

      The closest I get to preparing hyperlinks in flash is via the property inspector.  As I'm totally unfamiliar with extended coding and don't have the time to familiarise myself I'm a little stuck.  I've looked up every reference I can find on implementing asfunction to facilitate the above, but I just can't grasp it - I literally need 'do this, now do this' to make it stick in my brain.

       

      If anyone could help I'd be grateful.

        • 1. Re: Battling with asfunction using my tiny brain - losing...
          kglad Adobe Community Professional & MVP

          to create a link in a textfield, that textfield must be html-enabled and you must assign htmlText, not text:

           

           

          function yourfunction() {

          // do whatever

          }

           

          yourtextfield.htmlText = "<a href='asfunction:yourfunction'>your link</a>";  // notice single quotes and double quotes used.

           

           

          // replace yourfunction, do whatever, yourtextfield and your link with variables that make sense to you.  everything else, leave unchanged.

           

          // and that's it.  if you need to pass a parameter to yourfunction(), that's lesson 2 after you're comfortable with lesson 1 above.

          • 2. Re: Battling with asfunction using my tiny brain - losing...
            Mister.Tibbs Level 1

            Hi - thanks for replying, I am very grateful.

             

            I'm still stuck, though, as I have no idea what to do with the code you've provided - I wouldn't even know where to put it.  The result I want is the same as clicking a button with a gotoandplay command, but I don't how or where to apply such a command, so telling me to replace 'yourfunction' and 'do whatever' with whatever makes sense to me is like asking me to guess what's behind door number 3.

             

            If you want a specific example - I have one box of text (html text) with various links to external sites (which work fine) and I also want one link to take the user to frame number 159 in the timeline when they click that specific section of text.  I need to know where exactly to place the code and what the variables would be as I would just be guessing otherwise.  Once the penny drops I am sure using asfunction will be as simple as everything else I implement, but right now you might need to explain it like you would to a five year old.

             

            Thanks again.

            • 3. Re: Battling with asfunction using my tiny brain - losing...
              kglad Adobe Community Professional & MVP

              go the the timeline that contains your textfield and attached to a frame in that timeline where your textfield first appears, use:

               


              function gotoF() {

              gotoAndPlay(129);

              }

               

              tf.htmlText = "the first part of your text.  <a href='asfunction:gotoF'>your link</a> and the end of your text.";

               

               


               

              now, click on your textfield and assign it an instance name, tf.

              1 person found this helpful