Five3D multiline wordwrapping text

A couple of days ago I had a look into Five3D just because I had some time on my hands and I wanted to check out Five3D for a while now. One big thing I missed in this vector based 3D engine was word wrapping for text. A Google search led me to an inaccessible blog, so I decide to write the word wrapping myself.

Download the file here: Updated DynamicText3D.as (Compatible with v2.1.2)

Usage:

ActionScript

  1. var text3d: DynamicText3D = new DynamicText3D(HelveticaBold);
  2. text3d.size = 40;
  3. text3d.color = 0xffffff;
  4. // set a maximum width for the text
  5. text3d.maxWidth = 220;
  6. // flick word wrapping on
  7. text3d.wordWrap = true;
  8. text3d.text = "Something long enough to actually wrap...";
  9.  
  10. // Traces out the height of the text
  11. trace("text3d.textHeight")

I know it’s not perfect, but it’s working for me! 😉

2 thoughts on “Five3D multiline wordwrapping text

  1. Hi

    So that is what happens when I try to take a vacation; all my servers crash, and I get a bunch of email from people wanting my word wrap class.

    My site, the ‘inaccessible blog’ (blog.almostlogical.com) that you refer to is back up and running.

    My version does support some extra features, like dynamic word wrap auto sizing, exact textwidth calculation and also no extra overhead if wordwrap is not used.

    I’m blown away by the number of people that have been searching for a solution to this problem. I also apologize for my blog being down, because there is nothing more frustrating then finding a google search result only to find the site doesn’t work.

  2. Heya Devin,

    Thank you for your comment. I guess that’s Murphy’s Law for you, you go away and all fails. 😉
    It took me about an hour to get some word wrapping working for what I needed it for, so don’t worry. 🙂 Good to hear that your site is back up!

    Cheers,

    Wijnand

Leave a Reply

Your email address will not be published. Required fields are marked *