开发者

Flex 3: How Can I Position Text on an Angle?

I'd like m开发者_C百科y text to be positioned on a 45 degree angle. Is there an easy way to do that? (In the worst case, I could always make a png out of the text). But, I hope that there's away to do it in Flex. I don't need an animated effect.

var angleText:Text= new Text;
angleText:Text.text = "My text is angled!"
angleText:Text.x= 200;
angleText:Text.y= 300;

Any suggestions?

Thank you.

-Laxmidi


the Text in flex with System Fonts can not be rotated, go for embedded fonts,

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 <mx:Style source="main.css"/>
 <mx:Text text="Ankur Sharma" top="50" left="50" fontSize="50" fontFamily="Arbeka" rotation="45"/>
</mx:Application>

You have to do something in CSS file as well, and that is this :

/* CSS file */
@font-face 
{
   src:url("Arbeka.swf");
    fontFamily: "Arbeka";
}

But here you need this Arbeka.swf file which i have created in Flash, this is actually we r embedding fonts. this also helps, if the client side doesn;t have supported fonts, then your flex application won't be facing font problem.

I don't know , how to to attach this file here, if you need this one, give me ur mail address, i'll send u,

i checked it it's working , take care, hav a gr8 time

i m still using flex3. Wade is right above. flex4 has lot more as compare to 3


Try this tutorial. Take care to notice that you must use an embedded font or your rotated text will be invisible.


This is easy if you are using Flex 4. You do this by setting the "rotation" property to whatever angle in degrees (assuming you are using a Spark component, such as Label.) AND you don't need to embed a font to see it like you used to have to do in Flex 3.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜