Create an MXML-Based Module : MXML « Development « Flex






Create an MXML-Based Module

Create an MXML-Based Module
           
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
        
            private var lso : SharedObject;

            private function removeSharedObject() : void
            {
               var sampleData1 : String = "data1";
               var sampleData2 : String = "data2";

               lso = SharedObject.getLocal( "mylso" );
               lso.data.someData1 = sampleData1;
               lso.data.someData2 = sampleData2;
               lso.data.someData3 = "sampleData2";
               lso.flush();
               status.text = "\ndata1: " + lso.data.someData1
                             + "\ndata2: " + lso.data.someData2
                             + "\ndata3: " + lso.data.someData3;

               delete lso.data.someData1;
               status.text += "\n\nlso after deleting lso.data.someData1" 
                              + "\ndata1:"  + lso.data.someData1 
                              + "\ndata2:" + lso.data.someData2
                              + "\ndata3:" + lso.data.someData3;
               lso.clear();
               status.text += "\n\nlso data after calling clear()" + 
                              "\ndata1: " + lso.data.someData1 + 
                              "\ndata2: " + lso.data.someData2 + 
                              "\ndata3: " + lso.data.someData3;
            }
      
    </mx:Script>

    <mx:VBox width="100%" height="100%">
        <mx:Button label="remove a shared object" click="{ removeSharedObject() }" />
        <mx:TextArea id="status" width="100%" height="100%" />
    </mx:VBox>
</mx:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Long MXML Inline EventLong MXML Inline Event
2.MXML Inline TagMXML Inline Tag
3.MXML and ScriptMXML and Script
4.MXML Databinding between TextInput and LabelMXML Databinding between TextInput and Label
5.MXML Inline EventMXML Inline Event
6.MXML vs ActionScriptMXML vs ActionScript
7.set the viewSourceURL property by using MXMLset the viewSourceURL property by using MXML
8.Making MXML interactiveMaking MXML interactive
9. block in the MXML document<fx:Script> block in the MXML document
10.Escaping characters using the backslash characterEscaping characters using the backslash character
11.Changing the Flex default properties
12.flash system versionflash system version
13.Is debug modeIs debug mode
14.xmlns properties indicates that tags corresponding to the Spark component set use the prefix s:
15.override individual values in the plain settingoverride individual values in the plain setting
16.Inner tag can also have namespace
17.Add trace target to loggerAdd trace target to logger
18.Try catch errorTry catch error
19.MXML syntax and structureMXML syntax and structure
20.UI Controls aligned to centerUI Controls aligned to center
21.Modify ComponentsModify Components
22.x is a number that gets or sets component positionx is a number that gets or sets component position
23.id (short for identifier)id (short for identifier)
24.y sets component positiony sets component position
25.Combine stringsCombine strings
26.Flex MXML Tag ExampleFlex MXML Tag Example
27.Component with NamespaceComponent with Namespace
28.Add a Script tag, set a variableAdd a Script tag, set a variable
29.Set Tab Indexes for ComponentsSet Tab Indexes for Components
30.E4X In BracesE4X In Braces
31.Declare a variable and sets the value of that variable inside a functionDeclare a variable and sets the value of that variable inside a function
32.Specify an id value if you intend to refer to a component elsewhere in your MXMLSpecify an id value if you intend to refer to a component elsewhere in your MXML
33.Specify an id value to refer to a component else where in your MXMLSpecify an id value to refer to a component else where in your MXML