Multi column text layout

24 May'06
1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5 out of 5) Loading ... Loading ...    6,276 Views 586 Words

Most often in print media, one sees multi column layouts where the text overflows from one column to another.In flash, there is no way of connecting two dynamic text fields such that when you reach the end of the first column, the text automatically overflows to another columns (this is a very common feature in most of the print publishing softwares.)I recently came across a situation where I had to display such multi column text which overflows to another text field.I figured out a quick sollution, not sure if its the best way to do it.Heres what I did:Step-1:Create a vertical column of Dynamic text field, give it instance name 'myTXT'Step-1:Create another vertical column of Dynamic text field to the right side of the first one and name it 'myTXT1'Step-3:Dynamically load large piece of text in the first column 'myTXT' (for this example I am hard coding the text here): Step-4:Copy the same text to the other column like this: In most cases, the right side column will not be filled completely with text, it will be the residue of the first column.If the lines of text in second column are less then the total lines it can accomodate, the split will not be correct.To overcome this, lets add some extra breaks in the second column: Step-5:Last step is to move the scroll position of the second column text: Thats it, you should be ready to enjoy!!Download 2 column exampleDownload 3 column example---------------------------Update : 22 Jun' 2006---------------------------The above code works fine when the content in the first column is surely going to overflow to the second column.BUT, when the content in the first column is less, you get two columns with same content in both of them.Now thats not what we would like, right?So, here is a slight modification to the code posted earlier.To avoid situation like the one mentioned above, we will do one check. That is, we will populate the second column only when the first columns overflows.

Thanks to Paul Duquesnoy for contributing this modification.



feed    Powered by WordPress    Creative Commons License    mediatemple
Close
E-mail It