You are hereBlogs / daniel's blog / Multi-Column Layouts in Flash and Flex

Multi-Column Layouts in Flash and Flex


By daniel - Posted on 18 March 2008

Did some research and experimentation with multi-column layouts in Flash and Flex, or, more generally, having a single string get wrapped across multiple text fields. The demo below shows the progress so far.

This simple demo shows a string of text being automatically wrapped across four text fields.

When I first started looking into the problem I was happy to find a class for multi-column layouts in Adobe's newspaper layout example. Unfortunately, this implementation relied on the user specifying the number of lines per column.

In contrast, my version lets you place as many text fields as you like on the stage. Each text field can have different dimensions as well as different font styles. You simply tell the text wrapper manager the order of the text fields and what string to display and it automatically wraps the text.

The problem I've hit now, though, is dealing with HTML text. I figure the content will need to be at least partially parsed so you can maintain a list of which tags are open. Then, when you get to the end of the text field, you can close them all and re-open them at the beginning of the next text field.

However, even if that will work, I'm sure there will be some problems with text metrics of HTML content so I'll have to leave this problem for later.

Update: here's the source code for the above test using multi-column text.

Tags

About

Daniel McLaren

Daniel is a Flash and Flex developer specializing in the art of information visualization.

Syndicate content

SketchyD

Latest Drawing from SketchyD

This is the most recent drawing from my mobile sketch blog, SketchyD.com.

Popular Threads

Recent Comments