Flex3 Study Notes 2
Flex script Basics
In general, mxml is used for application layout and structure design, and various action operations on the application are implemented using ActionScript.Recognize the key to understanding the flex framework by working with ActionScript and mxml.
1) Inline ActionScript
Inline ActionScript: contains the mxml tag of the script house. As follows:
<Mx: button id = "mybutton" Click = "somecomponent. someproperty = 'something'"/>
Or:
<Mx: button label = "Click me" Click = "fullnametextinput. Text = 'John Smith '"/>
2) Assignment
Changing the attribute value can be called "value assignment ". For example:
Fullnametextinput. Text = "John Smith ";
That is:
<Mx: button label = "Click me" Click = 'fullnametextinput. Text = "John Smith" '/>
If you want to do more than two things at a time, such as clicking a button. Simply add multiple statements as follows:
<Mx: button label = "Click me" Click = "fullnametextinput. Text = 'John Smith '; expertcheckbox. Selected = true"/>
Note: Use semicolons to separate statements.
3) Functions
A function is a reusable code block. You can put some ActionScript code in the function and give the function a name. When using the function, reference this function.
Function placement location: It can be placed in the tag of the mxml file. The tag is: <mx: script/>
<Mx: SCRIPT>
<! [CDATA [
// Your code goes here
]>
</MX: SCRIPT>