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"
相关文档:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute" creationComplete="initApp()">
<mx:Script>
<![CDATA[
public var pageRecordes:uint = 8;
public var totalPages:ui ......
<?xml version="1.0" encoding="utf-8"?>
<Application xmlns="http://www.adobe.com/2006/mxml"
backgroundGradientColors="[0x000000,0x000000]"
themeColor="#222222"
horizontalAlign="left"
paddingLeft="10" paddingRight="10"
creationComplete="genData();"
viewSourceURL="srcview/index.ht ......
为了在应用程序中使用数据,Adobe Flex 包括了与HTTP servers,web services 或remoteobject services
(Java objects)进行交互的组件,这些组件被称之为远程过程调用(RPC)服务组件。
与 Adobe ColdFusion,PHP 或类似的服务器技术不同,Flex 应用程序并不直接连接数据
库。举 ......
分页组件: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 ......
//获得屏幕的分辨率
var x:Number=Capabilities.screenResolutionX;
var y:Number=Capabilities.screenResolutionY;
Alert.show("x="+x+"y="+y);
第二种方法
Alert.show(stage.fullScreenWidth+"=="+stage.fullScreenHeight);
//获得stage(工作区)的宽、高
Alert.show(stage.stageWidth+"=="+stage.stageHei ......