adding event listener vbox demo
This commit is contained in:
parent
428f98d5b7
commit
519d3c5bea
62
03b-event-listeners/VBoxDemo.mxml
Normal file
62
03b-event-listeners/VBoxDemo.mxml
Normal file
@ -0,0 +1,62 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
name="DemoApplication"
|
||||
backgroundColor="#FFFFFF"
|
||||
backgroundAlpha="0"
|
||||
creationComplete="initApp()"
|
||||
>
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import flash.events.EventPhase
|
||||
import mx.controls.Alert;
|
||||
|
||||
private function initApp():void {
|
||||
myVBox2.addEventListener("click", myHandleClick);
|
||||
myVBox3.addEventListener("click", myHandleClick2);
|
||||
}
|
||||
|
||||
private function myHandleClick(event:Event):void {
|
||||
label1.text = "You clicked VBox 2";
|
||||
}
|
||||
|
||||
private function myHandleClick2(event:Event):void {
|
||||
myVBox2.removeEventListener("click",myHandleClick);
|
||||
label1.text = "";
|
||||
}
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
<mx:Label text="Application"/>
|
||||
|
||||
<mx:VBox id="myVBox1"
|
||||
backgroundColor="#FFCCFF"
|
||||
width="300" height="100"
|
||||
horizontalAlign="center">
|
||||
|
||||
<mx:Label text="VBox 1" />
|
||||
|
||||
</mx:VBox>
|
||||
|
||||
<mx:VBox id="myVBox2"
|
||||
backgroundColor="#FFCCCC"
|
||||
width="300" height="100"
|
||||
horizontalAlign="center">
|
||||
|
||||
<mx:Label text="VBox 2" />
|
||||
|
||||
</mx:VBox>
|
||||
|
||||
<mx:VBox id="myVBox3"
|
||||
backgroundColor="#FFFFCC"
|
||||
width="300" height="100"
|
||||
horizontalAlign="center">
|
||||
|
||||
<mx:Label text="VBox 3" />
|
||||
|
||||
</mx:VBox>
|
||||
<mx:Label id="label1"
|
||||
width="80%" height="48"
|
||||
fontWeight="bold" />
|
||||
|
||||
</mx:Application>
|
Loading…
Reference in New Issue
Block a user