Flash 9 TextFields Rock!

Check out some of the new methods on the Flash 9 TextField object. Some stuff we’ve been dying for for years. Here’s a nice one:

getCharBoundaries(index)

Returns a rectangle that is pretty much the bounding box of the character specified by the index parameter. In other words the first character in the text field would be index 0, etc.

Here’s a really quick, crappy demo of something you could do with that. Needs a lot of work, for example, it pukes if you search multiline text. Actually, it finds the positions fine, just doesn’t handle them correctly. Would be easy to fix, but I was just playing.

Just type in a word in the text (case sensitive) and hit search.

[kml_flashembed movie=”http://www.bit-101.com/flash9/WordSearch.swf” height=”170″ width=”440″ /]

Neat, eh?

Source here.

This entry was posted in General. Bookmark the permalink.

14 Responses to Flash 9 TextFields Rock!

  1. C4RL05 says:

    getTextExtent must be weeping in his grave.

  2. gavin says:

    It’s amazing!!

  3. Saeed Ashour says:

    Could post the source? plz

  4. Philippe says:

    Mmmh… how many times would have I sold my soul for that feature?

  5. Exatcly what I needed for a project where the client asked to have text links in a html textfield that link to another page inside the same flash movie! …. unfortunately the project is for flash player 7.

  6. mark says:

    Impressive, yes, most impressive…

  7. kp says:

    Saeed, click the link that says “Source here”

  8. Bjorn Schultheiss says:

    Very nice…
    I love this method

  9. Sweet. I have to look into the other new methods now. I’d be embrassed if I wasn’t so proud of some of the hacks I have come up with in the past for even simple text field stuff. — JOR

  10. VinnyKwok says:

    Nice, however i am not sure if you guys notice that the boundary to be drawn in a funny way when i search for some part of the paragraph wrapping to the next line..

  11. kp says:

    Yup, as I said, “Needs a lot of work, for example, it pukes if you search multiline text. Actually, it finds the positions fine, just doesn’t handle them correctly.”

  12. brainy says:

    Sascha, you can use asfunction for that: livedocs link

Leave a Reply