flex 学习笔记
1.ActionScript中的变量使用的是严格数据类型。
2.圆角设置属性cornerRadius
3.Panel 拖拽功能实现
public function move_panel():void{
m_panel.startDrag();
}
public function stop_panel():void{
m_panel.stopDrag();
}
mouseDown="move_panel();" mouseUp="stop_panel();"
或 mouseDown="{this.startDrag()}" mouseUp="{this.stopDrag()}"
4.初始化时显示当天日期并设置开始日期小于结束日期:
<mx:DateField width="178" id="sTimeRoute" height="22" yearNavigationEnabled="true" formatString="YYYY-MM-DD" showToday="true" initialize="datefield_initializeHandler(event)"/>
<mx:DateField width="178" id="eTimeRoute" height="22" yearNavigationEnabled="true" formatString="YYYY-MM-DD" showToday="true" selectableRange="{{rangeStart:sTimeRoute.selectedDate}}" />初始化函数:
protected function datefield_initializeHandler(event:FlexEvent):void
{
eTimeRoute.selectedDate = new Date();
sTimeRoute.selectedDate = new Date();
}
5.Flex分隔栏
<mx:VDividedBox width="100%" height="100%">
<mx:Canvas label="Canvas 1" width="100%" height="100%" backgroundColor="#FFFFCC">
<mx:Label text="Add components here" fontWeight="bold"/>
</mx:Canvas>
<mx:Canvas label="Canvas 2" width="100%" height="100%" backgroundColor="#99CCFF">
<mx:Label text="Add components here" fontWeight="bold"/>
    </mx:Canvas>
 </mx:VDividedBox>
6.Flex中限制TextInput输入  
1. 限制某个字符的输入,用符号 ^ 跟上要限制的字符,可跟多个字符
      <!-- 限制字符"~"的输入 -->
     <mx:TextInput id="xxx"  restrict="^~" />
     <!-- 限制字符"ab"的输入 -->
     <mx:TextInput id="xxx"  restrict="^ab" />
2. 设置只能输入某些字符,将允许输入的字符罗列出来即可,也可以用 - 组合表示字符范围
      <!-- 只能输入abc -->
     <mx:TextInput id="xxx"  restrict="abc" />
     <!-- 只能输入小写字母 -->
     <mx:TextInput id="xxx"  restrict="a-z" />
     <!-- 只能输入小写字母、大写字母和数字 -->
     <mx:TextInput id="xxx"  restrict="a-zA-Z0-9" />
3. 组合使用
      <!-- 只能输入数字和符号"." -->
     <mx:TextInput id="xxx"  restrict="0-9." />
     <!-- 只能输入除ab之外的小写字母 -->
     <mx:TextInput id="xxx"  restrict="a-z^ab" /> 
4.其他
     只允许输入数字和负号:<s:TextInput id="textinput_LOGOLeftW" restrict="0-9\-\+" />
     只允许输入数字和点号:<mx:TextInput id="txt" restrict="0-9\." />
     只允许输入数字、英文、汉字:<mx:TextInput restrict="0-9\a-z\^{'[\u4e00-\u9fa5]'}" />
限制输入长度: maxChars=""
                    
                
                
            
        
浙公网安备 33010602011771号