public var user:SharedObject = SharedObject.getLocal("user"); private function setSharedObject():void{ if(this.rememberMe.selected){ user.data.firstname = this.firstName.text; user.data.rememberMe = this.rememberMe.selected; user.flush(); } } private function clearSharedObject():void{ this.rememberMe.selected = false; user.clear(); } <mx:Panel title="Shared Object Demo" width="350" height="200"> <mx:Form> <mx:FormItem label="FirstName" > <mx:TextInput id="firstName" text="{user.data.firstname}"/> </mx:FormItem> <mx:FormItem label="Remember Me" direction="horizontal"> <mx:CheckBox id="rememberMe" change="setSharedObject()" selected="{user.data.rememberMe}" /> </mx:FormItem> <mx:FormItem direction="horizontal"> <mx:Button label="clear SharedObject" click="clearSharedObject()"/> </mx:FormItem> </mx:Form> </mx:Panel>
Flex 本地缓存
最新推荐文章于 2014-01-02 19:17:46 发布