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

<mx:Application width="800" height="600" xmlns:mx="http://www.macromedia.com/2003/mxml" xmlns:local="*">
<local:VerticalLabel fontSize="15" text="SHOPPING"/>
</mx:Application>

2)VerticalLabel.mxml

<mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml">
<mx:Script>
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";
}
}
</mx:Script>
</mx:VBox>
  • Dane Iracleous

    Error: Could not resolve to a component implementation.

  • Name

    have you tested this? it looks like it’s been written straight to the fucking webpage

    • Yup! It was tested but dear friend, you gotta see when it was written – perhaps couple of years back. Now if you have a working version, why don’t you post here instead of using slangs?

      -abdul

  • I was looking for ways to display vertical text in flex… This is an interesting hack… However please do check out this from flex devnet technical faqs..
    http://www.adobe.com/devnet/flex/articles/flexfaq.html#itemA-39