2 Replies Latest reply on Jul 11, 2006 8:46 AM by Newsgroup_User

    mouse word

    Level 7
      Bit of a long shot I know, but does flash by any chance have a way to find
      which word the mouse is currently over in a dynamic text field?


        • 1. Re: mouse word
          amilton22
          I see two possible ways but both takes some time to do.

          1. You can create a textfield for every ord in a for statement then you can simply display the value when the mouse hovers over the textfield. When you load the dynamic text you must first separate each word, but should be possible since they are all seperated by a <SPACE>.

          2. The second way to do it simple but horribly to define the mouse._x and ._y cord where the word is. And trigger a if statement when your over it.
          • 2. Re: mouse word
            Level 7
            james,

            > Bit of a long shot I know, but does flash by any chance
            > have a way to find which word the mouse is currently
            > over in a dynamic text field?

            Director does, but Flash does not. In theory, it *may* be possible with
            a good bit of custom programming. Check out the TextField class of the
            ActionScript 2.0 Language Reference. You'll see two properties that might
            serve your purpose. Experiment with the TextField._xmouse and
            TextField._ymouse properties in cahoots with, say, the
            TextFormat.getTextExtent() method. Given a particular style (bold or
            normal, font size, etc.), this method returns the length of a string with
            those characteristics. You could feed this method a series of strings,
            progressively longer each time, that represent the individual words inside
            the text field and store the returned lengths in an array. Compare the
            mouse's position with those lengths, taking into account line breaks, of
            course -- which probably gets pretty convoluted.


            David
            stiller (at) quip (dot) net
            Dev essays: http://www.quip.net/blog/
            "Luck is the residue of good design."