Flex 写Cookie(类似Cookie)
登陆页面
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
import flash.net.navigateToURL;
private function setCookie():void{
if(txtUse.text == "admin" && txtPsw.text == "admin"){
var mycookie:SharedObject =SharedObject.getLocal("MyCookie","/");
mycookie.data.Name = txtUse.text;
mycookie.data.Password = txtPsw.text;
mycookie.flush();
var Url:URLRequest = new URLRequest();
Url.url = "http://localhost/Hello.swf";
navigateToURL(Url,"_parent");
}
}
private function getCookie():void{
var mycookie:SharedObject =SharedObject.getLocal("MyCookie","/");
lblUse.text = mycookie.data.Name;
lblPsw.text = mycookie.data.Password;
}
private function init():void{
var obj:SharedObject = SharedObject.getLocal("MyCookie","/");
txtUse.text = obj.data.Name;
txtPsw.text = obj.data.Password;
}
]]>
</mx:Script>
<mx:Label x="173" y="186" text="用户名:" width="135" height="28" fontSize="18"/>
<mx:Label x="173" y="263" text="密码:" width="91" height="27" fontSize="18"/>
<mx:TextInput x="316" y="184" width="171" id="txtUse" fontSize="18"/>
<mx:TextInput x="316" y="258" width="171" id="txtPsw" fontSize="18" displayAsPassword="true"/>
<mx:Button x="299" y="411" label="Submit" width="72" height="25" click="setCookie()"/>
<mx:Label x="547" y="184" width="118" height="32" fontSize="15" id="lblUse"/>
<mx:Label x="547" y="258" fontSize="15" width="118" id="lblPsw" height="34"/>
<mx:Button x="547"
相关文档:
过去在对DataGrid设置行背景色时,感觉还是挺方便的,只要重写DataGrid的,如下
private var _rowColorFunction:Function;
public function set rowColorFunction(f:Function):void
{
this._rowColorFunction = f;
}
public function get rowColorFunction():Func ......
PureMVC实现了简单的MVC框架,将应用分为model、view和control三部分。
好处很多了,降低了模块之间的耦合性、提高了程序的可维护性和可扩展性。
fabrication在PureMVC基础上做了扩展,简化了pureMVC的开发难度,下面简单介绍一下fabrication的开发过程。
首先,根据需要实现org.puremvc.as3.multicore.utilities.fabric ......
分页组件:Page.mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" >
<mx:Script>
<![CDATA[
&nbs ......
<mx:HSlider id="priceSlider" creationComplete="{HsilderChangeThumb(event)}"/>
<mx:Script>
<![CDATA[
private function HsilderChangeThumb(e:Event):void
{
var slider:HSlider = e.target as HSlider;
&nbs ......
Top 10 things new Flex developers should know
By Michael Portuesi | Published: November 27, 2009
While helping a coworker get started with Flash and Flex development, I thought it would be a good time to cover the list of things that I have found pretty essential to know about Flex development, co ......