Blog

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.

9 Responses to "Multiline WordWrap DynamicText3D in FIVe3D Part 2 (Now with Dynamic Alignment)"

  1. Ilya says:

    This is pretty cool. Is there a way to insert a new line character into text?

  2. Devin Reimer says:

    Unfortunately it does not support a new line character. I have started work on a new version to support the new FP10 version of FIVe3D, so I will add that item to the wishlist.

  3. Newton says:

    I doubt if FIVe3D 2.1.2 version really exist. would you mind updating your code according to the latest version of AS3 package

  4. Devin Reimer says:

    @Newton A few weeks ago Mathieu finished work on a FIVe3D redesign. So FIVe3D 2.1.2 is no longer available for download on his site. You might be able to track down that version from somewhere else. That being said I have started work on moving Multiline WordWrap functionality to the Five3D FP10 code base. A lot of changes have been made to this library so these changes will not occur over night. Hopefully like my ‘direct matrix access’ change it will actually get put directly into the FIVe3D library itself some time in the future.

  5. Would you mind updating your code according to the latest version of AS3 package

  6. Devin Reimer says:

    Hi @ClubPenguinCheats

    I put this on the back burner as it was going to require a bit of works. As your not the first person to ask about this, I will do my best to bump it up on my priority list.

  7. as3 version says:

    An as3.0 version would be so handy

Leave a response