天天看点

Flex 4 问题汇总

1、TileLayout内容间距设置

<s:layout>
<s:TileLayout horizontalGap="60" verticalGap="50" />
</s:layout>
           

2、spark皮肤中设置阴影

在skinClass关联的skin文件中加入:

<s:RectangularDropShadow id="dropShadow"
blurX="20" blurY="20" 
alpha="0.32" distance="11" 
angle="90" color="#000000" 
left="0" top="0" right="0" bottom="0"/>
           

3、鼠标悬停时更改组件的外观

例如更改背景颜色。在组件的skinClass关联的skin文件中做如下处理:

在<s:states>中添加悬停时的状态,如:

<s:states>
<s:state name="normal" />
<s:state name="disabled" />
<s:state name="rollOver" />
</s:states>
           

然后在<s:Rect>中设置颜色

<s:Rect height="100%" width="240">
	<s:fill>
		<s:SolidColor color="#AAAAAA" color.rollOver="#EFEEE9"/>
	</s:fill>
</s:Rect>
           

最后在声明当中添加rollOver,让鼠标悬停的时候,组件状态currentState切换到前面添加的rollOver

<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
	xmlns:s="library://ns.adobe.com/flex/spark"
	rollOver="currentState='rollOver'"
	rollOut="currentState='normal'">
           

4、使用FluorineFx调用remoting时,由于flex 4.5没有上下文路径的设置选项,造成请求gateway.aspx时总时访问站点根目录,而不是指定的虚拟路径。

解决:指定RemoteObject对象的endpoint属性为实际路径,如: "../Gateway.aspx"

5、数字转字符串时,保留指定位数的小数

var num:Numeric=3.1416;
var str:String=num.toFixed(2);  //括号里面的表示2位小数
           

(更新中......)

继续阅读