Flex Demo 2 - Basic Interaction
Submitted by jhallida on Mon, 04/19/2010 - 23:19
View Flex Demo 2
This program demonstrates a very basic interaction -- a listener for a button. The listener grabs the current text from a text box and displays that text in a label. The three Spark user components are as follows:
<s:Button x="172" y="10" label="Press Me" click="button1_clickHandler(event)"/>
<s:TextInput x="27" y="10" id="textInput" text="Insert Text Here"/>
<s:Label x="27" y="43" id="lbl" width="451" height="112" fontSize="36" fontFamily="Courier New" backgroundColor="#000000" color="#E64949"/>
The button click handler is as follows:
<fx:Script>
<![CDATA[
protected function button1_clickHandler(event:MouseEvent):void
{
lbl.text = textInput.text;
}
]]>
</fx:Script>
