Declare a variable and sets the value of that variable inside a function : MXML « Development « Flex






Declare a variable and sets the value of that variable inside a function

Declare a variable and sets the value of that variable inside a function
           

<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->



<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:s="library://ns.adobe.com/flex/spark"
    creationComplete="doSomething()">
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <fx:Script>
         
        public var s:Boolean; 
        public function doSomething():void { 
            s = label1.visible; 
            label1.text = "label1.visible = " + String(s); 
        } 
      
    </fx:Script>
    <s:Label id="label1" />
</s: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.Create an MXML-Based ModuleCreate an MXML-Based Module
21.UI Controls aligned to centerUI Controls aligned to center
22.Modify ComponentsModify Components
23.x is a number that gets or sets component positionx is a number that gets or sets component position
24.id (short for identifier)id (short for identifier)
25.y sets component positiony sets component position
26.Combine stringsCombine strings
27.Flex MXML Tag ExampleFlex MXML Tag Example
28.Component with NamespaceComponent with Namespace
29.Add a Script tag, set a variableAdd a Script tag, set a variable
30.Set Tab Indexes for ComponentsSet Tab Indexes for Components
31.E4X In BracesE4X In Braces
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