flex4 倾斜字体

倾斜字体要在flex3中做的话用
选择特效:
mx.effects.Rotate来处理
<mx:Script>
        <![CDATA[
           [Bindable]
            public var angle:int=0;
      ]]>
</mx:Script>
    <mx:Rotate id="rotate" angleFrom="{angle-45}" angleTo="{angle}" target="{myVB}"/>
<mx:Label showEffect="{rotate}" />
而在flex4中对label做了扩展,先上图:
flex4 倾斜字体
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
			   xmlns:s="library://ns.adobe.com/flex/spark"
			   xmlns:mx="library://ns.adobe.com/flex/mx">
	<s:layout>
		<s:VerticalLayout horizontalAlign="center" paddingTop="20" gap="20"/>
	</s:layout>
	<fx:Script>
		<![CDATA[
		]]>
	</fx:Script>
	<s:HSlider id="mySlider"
			   width="150"
			   minimum="-180" maximum="180" value="0"
			   liveDragging="true"/>
	<s:Label 
			 text="Rotated Text" fontSize="24"
			 rotation="{mySlider.value}"/>
	
</s:Application>


--TextFlow反转字体(0-360反转)
	<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
			 xmlns:s="library://ns.adobe.com/flex/spark"
			 xmlns:mx="library://ns.adobe.com/flex/halo"
			 width="500" height="300">
		<fx:Script>
			<![CDATA[
				import flash.text.engine.TextRotation;
				import flashx.textLayout.formats.BlockProgression;
				import flashx.textLayout.formats.VerticalAlign;
				import mx.collections.ArrayList;
				import spark.events.IndexChangeEvent;
				protected function rotateText(event:IndexChangeEvent):void {
					var target:String = event.target.selectedItem;
					switch(target) {
						case "0":
					//	Here, the textRotation for each character in the TextFlow is changed:
							tArea.textFlow.textRotation = TextRotation.ROTATE_0;
							break;
						case "90":
						tArea.textFlow.textRotation = TextRotation.ROTATE_90;
						break;
						case "180":
						tArea.textFlow.textRotation = TextRotation.ROTATE_180;
						break;
						case "270":
						tArea.textFlow.textRotation = TextRotation.ROTATE_270;
						break;
					}
					tArea.textFlow.invalidateAllFormats();
					tArea.textFlow.flowComposer.updateAllControllers();
				}
			]]>
		</fx:Script>
		<s:ComboBox change="rotateText(event)" x="400"
					dataProvider="{new ArrayList(['0', '90', '180', '270'])}"/>
		<s:RichText id="tArea" width="300" fontSize="20" paddingTop="10">
			<s:textFlow>
				<s:TextFlow>
					<s:p>
					中国四川省广安县协兴乡牌坊村的一个客家家庭
					</s:p>
					<s:p>
						Vertical alignment or justification (adopts default value if
						undefined during cascade). Determines how TextFlow elements
						align within the container.
					</s:p>
				</s:TextFlow>
			</s:textFlow>
		</s:RichText>
	</s:Group>

你可能感兴趣的:(flex4)