Flex 时间格式化 (转换)
在Flex应用中常常需要以一定的格式来显示时间,以下是一种做法。
首先创建一个DateFormatter 控件
<mx:DateFormatter id="df" formatString="YYYY-MM-DD JJ:NN:SS"/>
formatString="YYYY-MM-DD JJ:NN:SS"指定了时间的格式为2009-6-20 19:02:27,这里可以设置成自己需要的格式。
然后写个函数
//格式化时间
private function formatTM(item:Object):String
{
return df.format(item);// df就是上面的DateFormatter控件,item为需要格式化的数据。
}
然后在需要的地方调用该函数即可
var time:String=formatTM(需转换的时间)
相关文档:
2.2 代码实现
下面给出了FlexBuilder工程的一个文件,设置了Flash的布局。
view plaincopy to clipboardprint?
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
......
String userId = request.getParameter("userId");
System.out.println(userId);
response.setCharacterEncoding("UTF-8");
//response.getWriter().println("hello world -- 我爱你。。。");
String xml = "<user>" +
"<username>涛哥</username>" +
"</user>";
respon ......
原文地址:http://blog.163.com/to_yht/blog/static/1227257742009741359326/
当程序做完后,你是否还在为老套的flex组件默认效果发愁?是否还在为怎样设置自己的皮肤忙碌。那么这些可能是你需要的。
一 超酷皮肤主题推荐:
1. kingnarestyle:
下载地址:http://code.google.com/p/kingnarestyle/
2.Carbo ......
<?xml version="1.0"?>
<!-- Simple example to demonstrate the ProgressBar control. -->
<!--
如何使用Flex ProgressBar
MyShareBook.cn 翻译
-->
<mx:Applic ......
flashbuilder中可以建立flex工程与actionscript工程.
flex工程内可以使用mxml是完成设计工作.
actionscript工程建立时默认只有:
playerglobal.swc
flex.swc
utilities.sec
playerglobal.swc
这几个类库.没有framework.swc,就无法使用Button等控件了.
解决方案是 actionscript工程中加入framework.swc.
路径是 x:/A ......