Search Flex Components Free

Custom Search

December 27, 2007

Flex Miscellaneous Local Shared Objects Source Code Example:

sharedobjectdemo .mxml

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="" backgroundAlpha="0"


import mx.controls.Alert;

private var lso:SharedObject;

private function initApp():void {
if (lso == null)
{"Cannot create shared object", "Error");
if ( != null) firstName.text =;
if ( != null) lastName.text =;
if ( != null) email.text =;

private function saveInfo():void


<mx:Text width="100%" textAlign="center">
Fill in the form below and click the save button to save the information to the local shared object.
When you reload the application, the form is automatically populated with the data you saved.


<mx:FormItem label="First Name">
<mx:TextInput id="firstName" width="200"/>

<mx:FormItem label="Last Name">
<mx:TextInput id="lastName" width="200"/>

<mx:FormItem label="Email">
<mx:TextInput id="email" width="200"/>


<mx:Button label="Save to SharedObject" width="150" click="saveInfo()"/>
<mx:Button label="Clear SharedObject" width="150" click="lso.clear()"/>


Related Flex Tutorials