<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" width="144" horizontalGap="0" height="23"
creationComplete="init()" paddingLeft="0" paddingRight="0" paddingBottom="0" paddingTop="0" borderStyle="solid">
<fx:Script>
<![CDATA[
private var _now:Date = new Date();
[Bindable]private var iyear:int = _now.fullYear;
[Bindable]private var imonth:int = _now.month+1;
[Bindable]private var iday:int = _now.date;
[Bindable]private var ihour:int = _now.hours;
[Bindable]private var iminiute:int = _now.minutes;
[Bindable]private var isecond:int = _now.seconds;
private function init():void{
the_button.textDisplay.width = 0;
the_button.textDisplay.editable = false;
the_button.textDisplay.setStyle("borderVisible","false");
the_button.textDisplay.setStyle("borderStyle","none");
}
private var _textInput:TextInput = the_year;
public function get selectedDate():Date{
return new Date(iyear,imonth-1,iday,ihour,iminiute,isecond);
}
public function set selectedDate(value:Date):void{
if(value!=null){
iyear = value.fullYear;
imonth = value.month+1;
iday = value.date;
ihour = value.hours;
iminiute = value.minutes;
isecond = value.seconds;
}
}
protected function the_year_focusInHandler(event:FocusEvent):void
{
_textInput = the_year;
}
protected function the_month_focusInHandler(event:FocusEvent):void
{
_textInput = the_month;
}
protected function the_day_focusInHandler(event:FocusEvent):void
{
_textInput = the_day;
}
protected function the_hour_focusInHandler(event:FocusEvent):void
{
_textInput = the_hour;
}
protected function the_miniute_focusInHandler(event:FocusEvent):void
{
_textInput = the_miniute;
}
protected function the_second_focusInHandler(event:FocusEvent):void
{
_textInput = the_second;
}
/**
* format number's output
*/
private function formatNumberWithChar(value:Number,digit:Number,alpha:String):String{
var src:String = String(value);
if(src.length>=digit){
return src;
}else{
var len:int = digit - src.length;
var temp:String = "";
for(var i:int = 0; i<len; i++){
temp+=alpha;
}
return alpha+src;
}
}
protected function the_button_clickHandler(event:MouseEvent):void
{
if(event.target == the_button.incrementButton){
if(_textInput == the_year){ //year part
iyear +=1;
}else if(_textInput==the_month){ //month part
imonth+=1;
if(imonth>12) imonth = 1;
}else if(_textInput==the_day){
iday+=1;
if(iday>getMonthDays(iyear,imonth))
iday = 1;
}else if(_textInput==the_hour){
ihour+=1;
if(ihour>23) ihour = 0;
}else if(_textInput==the_miniute){
iminiute+=1;
if(iminiute>59) iminiute=0;
}else if(_textInput == the_second){
isecond+=1;
if(isecond>59) isecond = 0;
}
}else if(event.target==the_button.decrementButton){
if(_textInput == the_year){
if(iyear>1970)
iyear -=1;
}else if(_textInput==the_month){ //month part
imonth -= 1;
if(imonth<1) imonth=12;
}else if(_textInput==the_day){
iday -= 1;
if(iday<1) iday = getMonthDays(iyear,imonth);
}else if(_textInput==the_hour){
ihour -= 1;
; color: #0033ff; font-size: 10pt
分享到:
Global site tag (gtag.js) - Google Analytics
|
相关推荐
Flex 自定义 时间 日历 控件
flex自定义的一个IP控件,该IP控件就像我们操作系统里面的IP控件一样。
Flex 自定义的时间控件
Flex视图切换,自定义控件Demo.rar Flex视图切换,自定义控件Demo.rar Flex视图切换,自定义控件Demo.rar Flex视图切换,自定义控件Demo.rar
flex 自定义组件,UI,flex 自定义组件。
带有时间、小时分钟、格式化功能的日期控件
Flex 日期时间选择控件,可选择小时、分钟、12/24小时格式
FLex自定义写的控件,有时间,datagrid,tree,combox等,以及常用的处理字符串,弹出窗口
NULL 博文链接:https://whp0731.iteye.com/blog/726223
flex开发自定义控件
flex自定义的树形结构,展开,收缩,多级目录支持
Flex自定义加载条的一个小示例。里面有readMe文本
Flex 自定义ToolTip源代码,可以运行的源代码
Flex 自定义控件(包含源代码)这个已经够开发使用了
详解Flex4.0自定义控件的开发步骤以及注意事项
flex自带的日期控件是不带时间的,这个控件解决了这个问题。可直接使用
研究Flex 组件声明周期,了解组件的生成步骤
Flex中如何创建自定义排序DataGrid控件的例子
学习flex,学习开发自定义控件。顶起RIA应用程序!www的下一代技术!
FLEX自定义等待图标资源 18个SWF资源,19个GIF资源