For those of you that have never heard of FIVe3D, it is a lightweight vector based 3D library now written in AS3. You can check it out for yourself, http://five3d.mathieu-badimon.com.
In working on a small project using FIVe3D I discovered that while the 3D text part of the library is awesome it did not support multiline word wrap. I had seen examples of people using muliple DynamicText3D objects to fake text being multiline, but I wanted the text to be able to support dynamically word wrapping.
So I created a class called DynamicText3DMultiline which works the exact same way as the normal DynamicText3D class, but adds multiline wordwrap functionality. To use wordwrapping, simply set the width of the object and then set wordwrap equal to true.
var dynText:DynamicText3DMultiline; dynText = new DynamicText3DMultiline(HelveticaMedium); dynText.width = 200; dynText.size = 14; dynText.wordWrap = true;
There is next to no overhead in using this class instead of the DynamicText3D class when you don’t need the word wrapping feature, so as in my example this is now my standard text rendering class. Also it does have the added benefit have having a textHeight function.
To play the demo click here.
To get the demo source and the new DynamicText3DMultiline class click here.
Update: I have been informed that people have not been able to get this class to work with their own generated typography files. I have discovered the issue, it turns out there is a small bug in the Typography Generator. Luckly the solution is easy. Once you create a new typography AS file, open it up and go to line 15. Change the variable ‘__heights’ to ‘__height’, and word wrapping will work.
Update 2: A new version of the DynamicText3DMultline class has been released with new features. Please check out the new post.
Update 3: I have released a new version that now supports the newest versions of FIVe3D. To go to the new post click here.