Li : Dev Actionscript Development Blog

13Jan/094

Wishlist

I've created a little poll in order to see how you guys think development on the textfields branch should be prioritized. You should see it at the bottom of the right sidebar. I'd appreciate your votes and suggestions!

Note: If you think of something that doesn't show up in the poll, please comment it in this post.

Filed under: General 4 Comments
12Jan/097

Textfields and Lights : First Steps

These are the first results after experimenting for a few days with shape primitives and more advanced materials in the Away3D textfields branch. Click the image above to see the demo.

The demo consists of a font exported with the FontExporter component, used in a TextField3D, which is then extruded, a ShadingColorMaterial is applied as its extrusion material and a GradientColorMaterial is used with a little bit of trickery as its main material to enhance the lighting effect. The ShadingColorMaterial reacts to a PointLight3D object, which is a non-directional light.

Feel free to experiment. As soon as a bit more development is done with this, I'll upload some demos to demonstrate a few examples on how to use this.

Getting this far wasn't that easy, and it wouldn't have been possible without the help of Rob and Fabrice from the Away3D team. Thanks guys!!

A lot more to do, but it's looking good already ;D

Filed under: 3D 7 Comments
3Jan/0910

Dynamic TrueTypeFont Parsing

The Away3D textfields branch can now parse ttf files dynamically. You can use TTF.as to parse fonts embedded as byte data or to load and parse external font files at runtime:

[Embed(source="assets/Arial.ttf", mimeType="application/octet-stream")]

private var ArialEmbedded:Class;

var rawData:ByteArray = new ArialEmbedded();

var font:FontData = TTF.parse(rawData, "abcdef...");

or,

var font:FontData = TTF.load("assets/Arial.ttf", "abcdef...");

The TTF class uses a very compact true type font parser that should be able to handle simple ttf files for now, and is intended to be expanded in the future to support files with more complex data, such as different encoding types, compound characters etc.

If the dynamic parser cant handle a complex parsing case, you can use the FontExporter from my previous post to generate a font class. This alternative uses the Flash IDE's font parser which can parse any font. Its takes a little more work, but its flawless.

Click on the image to see a demo of 3 different Arial font usages with TextField3D; using the FontExporter, using the TTF.parse() method or the TTF.load() method. Right click to see the source.

Hope these tools makes the branch easier to use.

SVN: http://away3d.googlecode.com/svn/branches/textfields/src/away3d/

Filed under: 3D, Tutorials 10 Comments