6 Replies Latest reply on May 28, 2008 1:49 AM by budgiebird


      Hi Guys
      I have a text string in a text field. Some of the text is underlined to indicate links. I want to have a sprite intercept the underlined text and give feedback in some way. How can I identify when the sprite is over the underlined text? Or can you point me at an example.
      Thanks for your help.
        • 1. Re: Text
          robdillon Most Valuable Participant
          If you text doesn't scroll, then you could use the invisible button technique. You can use the toolbox rectangle tool to draw an empty borderless rectangle over the underlined text. Then you can use the sprite... intersects... method to detect when the one sprite touches the second sprite.
          • 2. Re: Text
            Chunick Level 3
            select the text you want to underline then use the hyperlink field in the property inspector and type in some identifier (here's where you have to do some planning as I have no idea what you mean by 'feedback in some way.')

            Then, put this handler in a movie script:

            on hyperlinkClicked data, range

            All the information about setting up hyperlinks in text members can be found in Director's help. Make sure you're using the toolbar in classic mode for Director's text members and NOT the flash components.
            • 3. Re: Text
              budgiebird Level 1
              Hi Guys, Thanks for the input. Unfortunately the text will scroll, and I am not using the cursor as the pointer. The pointer is a sprite. The cursor will be clicking buttons which moves the sprite (I’m trying to mimic an existing system here …).
              Yeah, I’ve not sorted out the feedback bit yet, text color change or background color change or ...., it just depends what works/is possible.
              • 4. Re: Text
                budgiebird Level 1
                Oh, and it is not a real hyperlink, I just want to infer one.
                On "hyperlink" selection we will jump to an appropriate point in the score. This is a totally enclosed system and is being built to test real product. I could custom build each page that contains links but I wondered if I could generate a more flexable / re-usable version. b.
                • 5. Re: Text
                  Level 7
                  You'll have to monitor the sprite location regularly, in an #enterFrame
                  handler, for example, and check this against the fontStyle of the
                  member's text. Something like the following might get you started
                  (completely untested email lingo):
                  property spriteNum
                  property my
                  property myTextSprite
                  property myTextMember

                  on beginSprite me
                  my = sprite(spriteNum)
                  myTextSprite = sprite(10) -- alter spriteNum to suit
                  myTextMember = myTextSprite.member

                  on enterFrame me
                  tLoc = my.loc
                  tWord = myTextSprite.pointToWord(tLoc)
                  if tWord > 0 then
                  tStyle = myTextMember.word[tWord].fontStyle
                  if tStyle.getPos(#underline) then
                  -- your sprite is over an underlined word
                  end if
                  end if
                  • 6. Re: Text
                    budgiebird Level 1
                    Hi Rob, Chunick and Sean, thanks for your time, and comments. I’ve sort of run out of time on this so scrolling stuff as discrete chunks. Drowning in ‘if then else’ statements ;-) However I've saved your input to my scrapbook, so will have a play when a gap appears in my space time continuum. Your thoughts are not lost. b.