Vertical Label in Macromedia Flex

Someone on Flexcoders asked, if it’s possible to show vertical label or text like this:

S
H
O
P
P
I
N
G

I wrote a simple MXML VerticalLabel component. Yet another example which shows the power of MXML components.



1)VerticalLabelExample.mxml



2)VerticalLabel.mxml\

import mx.controls.Label; import mx.controls.TextInput; import mx.controls.Text; var text:String; var textField; function createChildren():Void { var n = text.length; textField = createChild(Label,"textField"); textField.styleName = this; for(var i=0;i<n;i++) { textField.text+= text.charAt(i) + "\r"; } }