[virtualcommons-svn] SF.net SVN: virtualcommons:[379] mentalmodels/trunk/flex/src
Status: Beta
Brought to you by:
alllee
From: <kj...@us...> - 2009-11-29 22:06:41
|
Revision: 379 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=379&view=rev Author: kjonas Date: 2009-11-29 22:06:34 +0000 (Sun, 29 Nov 2009) Log Message: ----------- Changed actionscript/Communication.as to use Date instead of Timestamp Added custom/Communication.mxml class which has basic methods needed for communication-interface. - Client will create an Communication.as object and send to server, expecting server to push same object to all clients exactly once. - Client can display Communication.as objects that it receives from server. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/Communication.as Added Paths: ----------- mentalmodels/trunk/flex/src/custom/Communication.mxml Modified: mentalmodels/trunk/flex/src/actionscript/Communication.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/Communication.as 2009-11-29 19:23:30 UTC (rev 378) +++ mentalmodels/trunk/flex/src/actionscript/Communication.as 2009-11-29 22:06:34 UTC (rev 379) @@ -6,8 +6,8 @@ { public var id:Number; public var message:String; - public var timestamp:Timestamp; - public var student:Student; + public var date:Date; + public var student:actionscript.Student; public var round:Round; } } \ No newline at end of file Added: mentalmodels/trunk/flex/src/custom/Communication.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/Communication.mxml (rev 0) +++ mentalmodels/trunk/flex/src/custom/Communication.mxml 2009-11-29 22:06:34 UTC (rev 379) @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" defaultButton="{btnSelfComm}"> + + <mx:Script> + <![CDATA[ + import actionscript.Communication; + import actionscript.Student; + import mx.controls.Label; + import mx.controls.Text; + + public function btnSend_click():void + { + //<service>.<method>(txtMessage.text); + } + public function btnSelfComm_click():void + { + var comm:actionscript.Communication = new actionscript.Communication(); + comm.message = txtMessage.text; + comm.date = new Date(); + comm.student = new actionscript.Student(); comm.student.id = 1; + txtMessage.text = ""; + + commReceived(comm); + } + + public function commReceived(comm:actionscript.Communication):void + { + if(comm.message == null || comm.message.length == 0) return; + vbxMessages.addChild(commToText(comm)); + } + + private function strToText(str:String):Text + { + var newText:Text = new Text(); + newText.text = str; + return newText; + } + private function commToText(comm:actionscript.Communication):Text + { + var newText:Text = new Text(); + newText.text = "["+comm.date.toLocaleTimeString()+"] "+comm.student.id+": "+comm.message; + return newText; + } + + ]]> + </mx:Script> + + <mx:VBox id="vbxMessages" width="500" height="300"/> + <mx:HBox> + <mx:TextInput id="txtMessage" width="400"/> + <mx:Button id="btnSend" label="Send" click="btnSend_click()"/> + <mx:Button id="btnSelfComm" label="SelfComm" click="btnSelfComm_click()"/> + </mx:HBox> + +</mx:VBox> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |