Fun with code (since 2006)

Flash Player 10 Text Engine – Handling Animated Smileys


01.16.09 Posted in Actionscript 3 by

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.



29 Responses to “Flash Player 10 Text Engine – Handling Animated Smileys”

  1. Nate Beck says:

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

  2. TK says:

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

  3. Thibault Imbert says:

    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

  4. Really, really cool. I’m so much excited with my tests using FP10.

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

     
  6. joshspoon says:

    yeah that looks cool. I’d like it.

  7. halley says:

    Really cool …
    I want this class too…

  8. Pleh says:

    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.

  9. Thibault Imbert says:

    Hi Pleh,

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

    Thibault

  10. Pleh says:

    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.

  11. 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!

  12. Thibault Imbert says:

    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

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

     
  14. edzis says:

    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.

  15. Jloa says:

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

  16. Thibault Imbert says:

    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

  17. Jloa says:

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

  18. paranoio says:

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

  19. gropapa says:

    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…

  20. blah says:

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

  21. Thibault Imbert says:

    Hi blah,

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

    best,

    Thibault

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

     
  23. 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.

  24. peter says:

    would it be possible to have custom bullet points?!

  25. AlexeyB says:

    Source code links are broken.

  26. Thibault Imbert says:

    Hi AlexeyB,

    You can download the sources here :

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

    Thibault

  27. Andrew Ashbacher says:

    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

  28. Chris says:

    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…

Leave a Reply

Open Sort Options

Sort comments by:
  • * Applied after refresh

ByteArray.org
Fun with code since 2006.