2 Replies Latest reply on Oct 22, 2009 7:06 AM by cwsrit4173

    Text rotation

    cwsrit4173

      I want to rotate text about the center of the line/character.  I currently have 1 character in a label and if I rotate the label using the rotation property, it of course rotates about the top left corner of the label.  This throws off my layout so I would like to rotate it about the center of the character.  Is there an easy way to do this?

        • 1. Re: Text rotation
          cjtink

          you can try this:

           

          <mx:Label id="myLabel" width="100" height="30" text="M" creationComplete="{myRotate.play([myLabel]);}"/>

          <mx:Rotate id="myRotate" originX="{myLabel.width/2}" originY="{myLabel.height/2}" duration="1000" />

           

          myRotate will take effect when creationComplete event is called.

          get the center of the label by dividing the height and the width into 2, this will make the label rotate at its center.

           

          You can also neglect the use of duration.

           

          enjoy ^_^

          • 2. Re: Text rotation
            cwsrit4173 Level 1

            Thanks! Any helpful hints on how to get the rotated text to be a smooth edged as the un-rotated text? After embedding the font, the characters look sickly, all thin and jagged/pixelated on the edges.

             

            Using:

            [Embed(source='/assets/ARIAL.TTF',
                            fontName='Arial',
                            mimeType='application/x-font'
                         )]

            private var font1:Class;

             

            and fontFamily={font1}" on the label