box-o-sand/PracticingFlex/03a5-local-connections/BasicTaskReceiver.mxml

47 lines
1.5 KiB
Plaintext
Raw Normal View History

2010-02-18 20:07:53 +00:00
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="InitConn()"
backgroundAlpha="0"
backgroundColor="#FFFFFF">
<mx:Script>
<![CDATA[
import flash.net.LocalConnection;
private var conn:LocalConnection;
private function InitConn():void{
conn = new LocalConnection();
conn.client = this;
try {
conn.connect("taskConnection");
} catch (error:ArgumentError) {
trace("Can't connect.");
}
}
public function localconnectionHandler(msg:String):void {
textareaTasks.text= textareaTasks.text + msg + "\n";
}
private function clearTasks(event:MouseEvent):void {
textareaTasks.text="";
}
]]>
</mx:Script>
<mx:Panel horizontalCenter="0"
verticalCenter="0.5"
verticalGap="15"
paddingLeft="20" paddingRight="20" paddingBottom="20" paddingTop="20"
height="300" width="500">
<mx:Label text="Your tasks are..."/>
<mx:TextArea id="textareaTasks"
top="20" left="20" right="20" bottom="20"
width="100%" height="100%"/>
<mx:HBox>
<mx:Button id="btnClearTasks" click="clearTasks(event)" label="Clear Tasks"/>
</mx:HBox>
</mx:Panel>
</mx:Application>