Flash Player 10 Text Engine – Handling Animated Smileys by Thibault Imbert

Yesterday, I was playing with the new Flash Player 10 text engine and I clearly felt in love with it. The API is really powerful and you can do things just impossible to do in the past or at least hardly possible.

I came up with a little class handling different kind of smileys and even animated ones thanks to the GraphicElement class which can contain any kind of DisplayObject and therefore also the GIFPlayer class.

Notice how the Flash Player automatically handles spaces and line height break so that the GraphicElement perfectly fits. There is so much things to experiment with it !

Each time a smiley code is detected, if a Bitmap or an instance of the GIFPlayer is linked to that key the smiley is shown.

Here is a little demo :

A Flash animation should have appeared here, but it seems that your browser has an older version of the Flash Player or it is not installed at all. Please, install the last release of the Flash Player now, then reload this page.

If you guys are interested in such a class, let me know, so that I polish it and post it.

Comments (26)

  1. Nate Beck wrote::

    That is loads of fun! I’d be interested in taking a look at the code behind that.

    Friday, January 16, 2009 at 3:01 am #
  2. TK wrote::

    This is genius! We’d absolutely love some source :)

    Friday, January 16, 2009 at 3:09 am #
  3. Thibault Imbert wrote::

    Hi Nate,

    I am happy you like it. The whole class is around 100 lines maximum and is very easy to use. I will post it in a few days, time to add maybe some other features. :)

    Thibault

    Friday, January 16, 2009 at 3:10 am #
  4. Really, really cool. I’m so much excited with my tests using FP10.

    Friday, January 16, 2009 at 3:10 am #
  5. joshspoon wrote::

    yeah that looks cool. I’d like it.

    Friday, January 16, 2009 at 10:29 am #
  6. halley wrote::

    Really cool …
    I want this class too…

    Friday, January 16, 2009 at 12:02 pm #
  7. Pleh wrote::

    Funnily enough, I was also playing around with the new text engine yesterday. I was trying to get a basic text edit control working it took me a few hours to get it working so if anyone wants an example, let me know.

    Friday, January 16, 2009 at 1:17 pm #
  8. Thibault Imbert wrote::

    Hi Pleh,

    Excellent ! You can post a link here so that we can have a look ;)

    Thibault

    Friday, January 16, 2009 at 1:24 pm #
  9. Pleh wrote::

    Hi Thibault,

    I have uploaded an example here…

    http://www.pleh.co.uk/experiments/textengine/textbox.as.txt

    and a simple example of using it here…

    http://www.pleh.co.uk/experiments/textengine/textboxexample.as.txt

    this is very a basic example, but its a good starting point.

    Friday, January 16, 2009 at 2:12 pm #
  10. Excellent, I was just about to try this myself – now I don’t have to :-)
    Please can someone send me a code sample? I’ll give full credit. stefan AT flashcomguru.com

    thx!

    Friday, January 16, 2009 at 5:30 pm #
  11. Thibault Imbert wrote::

    Hi guys,

    I just posted a “classic” version if you want to see how it works :

    http://www.bytearray.org/wp-content/projects/smileyengine/smiley-engine.zip

    Note that this version does not handle animated GIF’s, I will post the animated version in a few days.

    Thibault

    Friday, January 16, 2009 at 5:55 pm #
  12. edzis wrote::

    This text is not selectable? Is it because you simply set selectable = false, or there needs t be some extra work for that? Would be good to allow reusing the text with all the smiley codes if the reader wishes so.

    Friday, January 16, 2009 at 7:37 pm #
  13. Jloa wrote::

    Dah, nice as always. But does it have xhtml support?

    Saturday, January 17, 2009 at 12:16 am #
  14. Thibault Imbert wrote::

    Hi edzis,

    Yes it would need some extra work to enable editing.

    Jloa,

    It would also need some little work to implement XHTML support :)

    Thibault

    Saturday, January 17, 2009 at 2:30 pm #
  15. Jloa wrote::

    Thibault, xhtml support would be awesome especially if the table tag would appear ^_^

    Saturday, January 17, 2009 at 3:04 pm #
  16. paranoio wrote::

    just as a reference this is a similar project based on as2 http://fosforo.theninjabunny.com/

    Sunday, January 18, 2009 at 9:43 pm #
  17. gropapa wrote::

    pffff qd je pense que j arrive meme pas a mettre une image entre 2 textes ds un textField avec Flash9…vivement que je passe au 10…

    Monday, January 19, 2009 at 3:11 pm #
  18. blah wrote::

    I had to click through 14 runtime errors, wassup with that?

    Tuesday, January 20, 2009 at 4:02 am #
  19. Thibault Imbert wrote::

    Hi blah,

    Wow 14 errors ? Can you tell me more about them ? What kind of errors is it ?

    best,

    Thibault

    Tuesday, January 20, 2009 at 11:33 am #
  20. That’s so pretty cool! Many thank to you, Thibault! Great finding in FP10. This is exactly what I need.

    I still neeed to figure out if it’s possible to use html formated text. But your code is a good start for me.
    Thanks.

    Thursday, January 22, 2009 at 7:35 pm #
  21. peter wrote::

    would it be possible to have custom bullet points?!

    Thursday, February 5, 2009 at 11:44 am #
  22. AlexeyB wrote::

    Source code links are broken.

    Friday, May 29, 2009 at 1:04 pm #
  23. Thibault Imbert wrote::

    Hi AlexeyB,

    You can download the sources here :

    http://www.bytearray.org/?p=521

    Thibault

    Friday, May 29, 2009 at 1:08 pm #
  24. Andrew Ashbacher wrote::

    Peter,

    Yes, it’s totally possible to have custom bullets. I just finished a project for a client using the flash.text.engine classes with custom bullets. Very straightforward.

    -Andrew

    Friday, June 26, 2009 at 9:18 pm #
  25. Zashkaser wrote::

    OMG…totally!

    Wednesday, August 5, 2009 at 6:58 pm #
  26. Chris wrote::

    That’s great~! I’m also looking at the text engine right now, I just wonder how you managed to handle mouse click.
    I’m trying to get a spark Button inside a GraphicElement, so far I can only display it, but no mouse click/over effect…

    Friday, April 9, 2010 at 11:05 am #

Trackbacks/Pingbacks (3)

  1. Weekly Shared Items - 16. January, 2009 « toxin 2.0 on Friday, January 16, 2009 at 10:01 am

    [...] Flash Player 10 Text Engine [ by Thibault Imbert ] [...]

     
  2. [...] > Flash Player 10 Text Engine by Thibault Imbert < ByteArray.org [...]

     
  3. [...] Flash Player 10 Text Engine [ by Thibault Imbert ] (from ByteArray.org) [...]