Blog

Multiline WordWrap DynamicText3D in FIVe3D Part 3 – AS3 & FP10 New Version Support

June 28, 2010 by Devin Reimer

After getting a lot of requests to update my Multiline Word Wrap DynamicText3D class to support the newest versions of FIVe3D, I have finally created an updated version. The new version supports both
FIVe3D_package_AS3_v1.1.3 and FIVe3D_package_AS3_F10_v1.0.2.

Quick example on how to use this class.

var dynText:DynamicText3DMultiline;
dynText = new DynamicText3DMultiline(new HelveticaMedium());
dynText.width = 200;
dynText.align =  DynamicText3DMultiline.CENTER;
dynText.lineSpacing = 5;
dynText.wordWrap = true;

Note: If you do not set wordWrap=true this class will work exactly the same way as DynamicText3D and will have no extra overhead.

To play the demo click here.

To get the demo source, including the newest version of the DynamicText3DMultiline class click here.

To download the newest version of the DynamicText3DMultiline class click here.

Source Requirements: You will need FIVe3D (AS3_v1.1.3 or F10_v1.0.2). To compile the demo source you will also need TweenMax.

Multiline WordWrap DynamicText3D in FIVe3D Part 2 (Now with Dynamic Alignment)

July 19, 2009 by Devin Reimer

FIVe3D WordWrap Part 2 Screenshot

Update: I have released a new version that now supports the newest versions of FIVe3D. To go to the new post click here.

For those of you that have not read my original blog post on multiline wordwrap in FIVe3D. You can go read the article here.

I didn’t intend of expanding my DynamicTextMultiline class, but as I was working on another project I ended up adding to it and expanding its feature set. I have now implemented dynamic alignment (left,right,center) and line spacing, as well as fixed a small bug involving multiline text width. I have also updated the package path of the class to a more logical location (almostlogical.five3d.display).

Using dynamic alignment and line spacing is very easy:

var dynText:DynamicText3DMultiline;
dynText = new DynamicText3DMultiline(HelveticaMedium);
dynText.width = 200;
dynText.align =  DynamicText3DMultiline.CENTER;
dynText.lineSpacing = 5;
dynText.wordWrap = true;

This class has been programmed in such a way that you can use it even if you don’t need to use word wrap because it has almost no additional performance impact when wordwrap=false. Plus now you get the added benefit of being able to dynamically align your text.

This demo is the same as Part 1 except it includes the ability to change the alignment of the text (left,right,center) in real-time.

Note: For performance reasons I recommend setting text.wordwrap=true as the very last property you set.

To play the demo click here.

To get the demo source, including the newest version of the DynamicText3DMultiline class click here.

To just download the newest version of the DynamicText3DMultline class click here.

Source Requirements: You will need both FIVe3D 2.1.2 and TweenMax to compile the demo source.

Note: If you are having problems using word wrapping with generated fonts (not the default Helvetica fonts), please refer to the solution in the previous post.

Multiline WordWrap DynamicText3D in FIVe3D

June 23, 2009 by Devin Reimer

FIVe3D Word Wrap Screenshot

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.

Source Requirements: You will need both FIVe3D 2.1.2 and TweenMax to compile the demo source.

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.