[virtualcommons-svn] SF.net SVN: virtualcommons:[262] mentalmodels/trunk
Status: Beta
Brought to you by:
alllee
From: <kj...@us...> - 2009-08-18 23:19:44
|
Revision: 262 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=262&view=rev Author: kjonas Date: 2009-08-18 23:19:35 +0000 (Tue, 18 Aug 2009) Log Message: ----------- StartGame.mxml should be working to start the game. FisheryExperimentCore.mxml does not work with the database properly - createStudent needs to be changed I do not know if it will all work - I do not understand what "Merged" implies, exactly, so something may or may not have been lost. Modified Paths: -------------- mentalmodels/trunk/flex/src/StartGame.mxml mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf mentalmodels/trunk/src/main/webapp/StartGame.swf Added Paths: ----------- mentalmodels/trunk/flex/src/test.mxml mentalmodels/trunk/src/main/webapp/playerProductInstall.swf mentalmodels/trunk/src/main/webapp/test.html mentalmodels/trunk/src/main/webapp/test.swf Modified: mentalmodels/trunk/flex/src/StartGame.mxml =================================================================== --- mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-18 22:43:42 UTC (rev 261) +++ mentalmodels/trunk/flex/src/StartGame.mxml 2009-08-18 23:19:35 UTC (rev 262) @@ -4,14 +4,14 @@ <mx:VBox visible="{pageNum==0}" horizontalAlign="center"> <mx:HBox horizontalAlign="right" width="330" id="firstBox"> <mx:Label text="$USD per lb of fish:"/> - <mx:TextInput id="txtMoney"/> + <mx:NumericStepper id="stpMoney" stepSize="0.01" minimum="0.01" maximum="9999"/> </mx:HBox> <mx:HBox horizontalAlign="right" width="{firstBox.width}"> - <mx:Label text="Brief description of game:"/> - <mx:TextArea id="txtDescription"/> + <mx:Label text="Very brief description of game:"/> + <mx:TextInput id="txtDescription" maxChars="5"/> </mx:HBox> - <mx:Button label="Create Game" id="btnCreateGame" click="false"/> + <mx:Button label="Create Game" id="btnCreateGame" click="create()"/> <mx:HBox horizontalAlign="right" width="{firstBox.width}"> <mx:Label text="Game ID:"/> <mx:TextInput id="txtGameID" enabled="false"/> @@ -20,7 +20,7 @@ <mx:Spacer height="30"/> <mx:Text text="Click the Start Game button only after all students have connected using the above ID." width="300"/> - <mx:Button label="Start Game" id="btnStartGame" click="feed.start()"/> + <mx:Button label="Start Game" id="btnStartGame" click="start()" enabled="false"/> </mx:VBox> <mx:VBox visible="{pageNum==1}"> @@ -28,10 +28,14 @@ <mx:VBox id="responsesContent"/> </mx:VBox> - <mx:RemoteObject id="feed" destination="feed" fault="{faultHandler(event)}" /> + <mx:RemoteObject id="startupService" destination="startupService" fault="faultHandler(event)"> + <mx:method name="createGame" result="gameObjectResultHandler(event)"/> + <mx:method name="startGame" result="noResultHandler(event)"/> + </mx:RemoteObject> <mx:Script> <![CDATA[ + import actionscript.Game; import actionscript.Block; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; @@ -39,16 +43,52 @@ [Bindable]private var pageNum:int = 0; + // Universal Fault Handler public function faultHandler(event:FaultEvent):void { Alert.show(event.fault.getStackTrace()); } + // Button Click Events + public function create():void + { + stpMoney.enabled = txtDescription.enabled = btnCreateGame.enabled = false; + + var gameObject:Game = new Game(); + gameObject.money = stpMoney.value; + gameObject.description = txtDescription.text; + } + public function start():void + { + btnStartGame.enabled = false; + + startupService.startGame(); + } public function getResponses():void { } + + // Server Response Events + public function gameObjectResultHandler(event:ResultEvent):void + { + if(event.result != null) + { + txtGameID.text = (event.result as Game).description; + btnStartGame.enabled = true; + } + else + { + stpMoney.enabled = txtDescription.enabled = btnCreateGame.enabled = true; + } + } + public function noResultHandler(event:ResultEvent):void + { + + } + ]]> </mx:Script> </mx:Application> + Added: mentalmodels/trunk/flex/src/test.mxml =================================================================== --- mentalmodels/trunk/flex/src/test.mxml (rev 0) +++ mentalmodels/trunk/flex/src/test.mxml 2009-08-18 23:19:35 UTC (rev 262) @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> + + <mx:HBox> + <mx:Button label="roundService.getBlock()" click="roundService.getBlock()"/> + <mx:Button label="roundService.getCurrentRound()" click="roundService.getCurrentRound()"/> + <mx:Button label="startupService.createStudent()" click="startupService.createStudent()"/> + <mx:Button label="answeringService.saveStrategy()" click="answeringService.saveStrategy()"/> + <mx:Button label="locationService.getAllLocations()" click="locationService.getAllLocations()"/> + </mx:HBox> + + <mx:RemoteObject id="roundService" destination="roundService" fault="faultHandler(event)"> + <mx:method name="getBlock" result="resultHandler(event)"/> + <mx:method name="getCurrentRound" result="resultHandler(event)"/> + </mx:RemoteObject> + <mx:RemoteObject id="startupService" destination="startupService" fault="faultHandler(event)"> + <mx:method name="createStudent" result="resultHandler(event)"/> + </mx:RemoteObject> + <mx:RemoteObject id="answeringService" destination="answeringService" fault="faultHandler(event)"> + <mx:method name="saveStrategy" result="resultHandler(event)"/> + </mx:RemoteObject> + <mx:RemoteObject id="locationService" destination="locationService" fault="faultHandler(event)"> + <mx:method name="getAllLocations" result="resultHandler(event)"/> + </mx:RemoteObject> + + <mx:Script> + <![CDATA[ + import mx.core.UIComponent; + import mx.controls.Alert; + import mx.rpc.events.FaultEvent; + import mx.rpc.events.ResultEvent; + + public function resultHandler(event:ResultEvent):void + { + var str:String = ""; + str += "event == null : " + (event == null) + "\n"; + str += "event.result == null : " + (event.result == null) + "\n"; + + Alert.show(str, "resultHandler()"); + } + + public function faultHandler(event:FaultEvent):void + { + var str:String = ""; + str += "event.fault.message:\n" + (event.fault.message) + "\n\n"; + str += "event.fault.getStackTrace():\n*START*\n" + (event.fault.getStackTrace()) + "\n*END*"; + + Alert.show(str, "faultHandler()"); + } + + ]]> + </mx:Script> + +</mx:Application> Modified: mentalmodels/trunk/src/main/webapp/FisheryExperimentShell.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/InitialiseDatabase.swf =================================================================== (Binary files differ) Modified: mentalmodels/trunk/src/main/webapp/StartGame.swf =================================================================== (Binary files differ) Added: mentalmodels/trunk/src/main/webapp/playerProductInstall.swf =================================================================== (Binary files differ) Property changes on: mentalmodels/trunk/src/main/webapp/playerProductInstall.swf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: mentalmodels/trunk/src/main/webapp/test.html =================================================================== --- mentalmodels/trunk/src/main/webapp/test.html (rev 0) +++ mentalmodels/trunk/src/main/webapp/test.html 2009-08-18 23:19:35 UTC (rev 262) @@ -0,0 +1,137 @@ +<!-- saved from url=(0014)about:internet --> +<html lang="en"> + +<!-- +Smart developers always View Source. + +This application was built using Adobe Flex, an open source framework +for building rich Internet applications that get delivered via the +Flash Player or to desktops via Adobe AIR. + +Learn more about Flex at http://flex.org +// --> + +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + +<!-- BEGIN Browser History required section --> +<link rel="stylesheet" type="text/css" href="history/history.css" /> +<!-- END Browser History required section --> + +<title></title> +<script src="AC_OETags.js" language="javascript"></script> + +<!-- BEGIN Browser History required section --> +<script src="history/history.js" language="javascript"></script> +<!-- END Browser History required section --> + +<style> +body { margin: 0px; overflow:hidden } +</style> + +<script language="JavaScript"> + window.onbeforeunload = confirmExit; + function confirmExit() + { + return "If you are connected to the server, you will be disconnected if the page closes. Students in the experiment will be removed if the window closes."; + } +</script> + +<script language="JavaScript" type="text/javascript"> +<!-- +// ----------------------------------------------------------------------------- +// Globals +// Major version of Flash required +var requiredMajorVersion = 9; +// Minor version of Flash required +var requiredMinorVersion = 0; +// Minor version of Flash required +var requiredRevision = 124; +// ----------------------------------------------------------------------------- +// --> +</script> +</head> + +<body scroll="no"> + +<script language="JavaScript" type="text/javascript"> +<!-- + +var clientIP = '<!--#echo var="REMOTE_ADDR"-->'; + +// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) +var hasProductInstall = DetectFlashVer(6, 0, 65); + +// Version check based upon the values defined in globals +var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); + +if ( hasProductInstall && !hasRequestedVersion ) { + // DO NOT MODIFY THE FOLLOWING FOUR LINES + // Location visited after installation is complete if installation is required + var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; + var MMredirectURL = window.location; + document.title = document.title.slice(0, 47) + " - Flash Player Installation"; + var MMdoctitle = document.title; + + AC_FL_RunContent( + "src", "playerProductInstall", + "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+'&ip=test'+clientIP+"", + "width", "100%", + "height", "100%", + "align", "middle", + "id", "test", + "quality", "high", + "bgcolor", "#869ca7", + "name", "test", + "allowScriptAccess","sameDomain", + "type", "application/x-shockwave-flash", + "pluginspage", "http://www.adobe.com/go/getflashplayer" + ); +} else if (hasRequestedVersion) { + // if we've detected an acceptable version + // embed the Flash Content SWF when all tests are passed + AC_FL_RunContent( + "src", "test", + "width", "100%", + "height", "100%", + "align", "middle", + "valign", "middle", + "id", "test", + "quality", "high", + "bgcolor", "#869ca7", + "name", "test", + "allowScriptAccess","sameDomain", + "type", "application/x-shockwave-flash", + "pluginspage", "http://www.adobe.com/go/getflashplayer", + "FlashVars", "ip=test"+clientIP+"" + ); +} else { // flash is too old or we can't detect the plugin + var alternateContent = 'Alternate HTML content should be placed here. ' + + 'This content requires the Adobe Flash Player. ' + + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>'; + document.write(alternateContent); // insert non-flash content + } +// --> +</script> +<noscript> + <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" + id="test" width="100%" height="100%" + codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"> + <param name="movie" value="test.swf" /> + <PARAM NAME=FlashVars VALUE="ip=test${clientIP}"> + <param name="quality" value="high" /> + <param name="bgcolor" value="#869ca7" /> + <param name="allowScriptAccess" value="sameDomain" /> + <embed src="test.swf" quality="high" bgcolor="#869ca7" + width="100%" height="100%" name="test" align="middle" + play="true" + loop="false" + quality="high" + allowScriptAccess="sameDomain" + type="application/x-shockwave-flash" + pluginspage="http://www.adobe.com/go/getflashplayer"> + </embed> + </object> +</noscript> +</body> +</html> Added: mentalmodels/trunk/src/main/webapp/test.swf =================================================================== (Binary files differ) Property changes on: mentalmodels/trunk/src/main/webapp/test.swf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |