4 Replies Latest reply on Oct 22, 2006 4:29 AM by andyulrika_is_back

    Help with code for unresolved hyperlink issue

    andyulrika_is_back Level 1
      Hello

      Can someone please help with this one - I need some code to do the following:

      To be able to click on a hyperlink within a text sprite and jump to another marker location within the score. At the new position some text at the foot of the page displays - 'return to (name of previous marker)'. This should only display if a hyperlink was used.

      Help much appreciated.

      Andy

        • 1. Re: Help with code for unresolved hyperlink issue
          duckets Level 1
          The simplest way to do this would be to use a global variable to store the frame label when a hyperlink is clicked. eg:

          -------------------------
          global backFrameLabel
          on mouseUp me
          backFrameLabel = the frameLabel
          end
          -------------------------

          Then, on frames which require the back button, you'll need to check whether the 'backFrameLabel' global contains a label name. If so, you make your button visible, set its text, and make the mouseup function work. if not, the button should be invisible (moved off stage). Finally, when the back button is used, the 'backFrameLabel' should be cleared.

          Something like this:

          -----------------------------------

          global backFrameLabel

          on beginsprite me
          if stringP(backFrameNumber) then
          sprite(me.member.text) = "Return to "&backFrameLabel
          else
          sprite(me.spritenum).loch = -9999
          end if
          end

          on mouseup me
          if stringp(backFrameLabel) then
          goFrameLabel = backFrameLabel
          backFrameLabel = void
          go to frame(goFrameLabel)
          end if
          end
          -----------------------------------

          hope this helps!
          (note - written in reply box, untested lingo!)

          - Ben

          • 2. Re: Help with code for unresolved hyperlink issue
            andyulrika_is_back Level 1
            Hi Ben

            Thanks again. But I'm getting a script error when attaching the second part of your coding below
            and don't know how to fix.

            Which displays the following:
            Script Error: Expected =
            sprite(me.member.text)=? "Return to &backFrameLabel

            Also, I changed the code in the second part of your coding which referenced - if stringP(backFrameNumber) to if stringP(backFrameLabel)

            Can you help?

            Thanks in advance

            Andy
            • 3. Re: Help with code for unresolved hyperlink issue
              Level 7
              >>sprite(me.member.text) = "Return to "&backFrameLabel

              This line should read:

              sprite(me.spriteNum).member.text = "Return to "&backFrameLabel

              --
              Dave -
              Head Developer
              www.blurredistinction.com
              Adobe Community Expert
              http://www.adobe.com/communities/experts/


              • 4. Re: Help with code for unresolved hyperlink issue
                andyulrika_is_back Level 1
                Hi Dave

                Thanks for that piece of code - This fixed it. Although, I still can't get the code to do exactly what I want...

                So far, I can get the text on the target marker to display "return to (previous marker name)" but clicking on this doesn't actively take me back to the previous marker and the offstage code totally makes the sprite dissapear.

                Here is what I have done so far -

                Created a global script within the cast

                global backFrameLabel
                on mouseUp me
                backFrameLabel = the frameLabel
                end

                Attached the following code to my Text sprite on the stage:

                global backFrameLabel
                on mouseUp me
                backFrameLabel = the frameLabel
                end

                on hyperLinkClicked me, data,
                go data
                end

                On the target frame I created a field text sprite at the foot of the page and attached the following:

                global backFrameLabel

                on beginsprite me
                if stringP(backFrameLabel) then
                sprite(me.spriteNum).member.text = "Return to "&backFrameLabel
                else

                end if
                end

                on mouseup me
                if stringp(backFrameLabel) then
                goFrameLabel = backFrameLabel
                backFrameLabel = void
                go to frame(goFrameLabel)
                end if
                end

                The previous frame label is displayed but I can't get it to jump back to the frame label when clicking on it.
                Any ideas?

                regards

                Andy