[virtualcommons-svn] SF.net SVN: virtualcommons:[376] mentalmodels/trunk/flex/src
Status: Beta
Brought to you by:
alllee
From: <kj...@us...> - 2009-11-29 18:51:41
|
Revision: 376 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=376&view=rev Author: kjonas Date: 2009-11-29 18:51:32 +0000 (Sun, 29 Nov 2009) Log Message: ----------- FisheryExperimentCore.mxml now accepts Game objects, rather than Block only. Other files changed to pass the game object along the hierarchy wherever needed. Modified Paths: -------------- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml mentalmodels/trunk/flex/src/custom/InstructionPage.mxml mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml Modified: mentalmodels/trunk/flex/src/actionscript/PageDisplay.as =================================================================== --- mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-11-25 23:31:53 UTC (rev 375) +++ mentalmodels/trunk/flex/src/actionscript/PageDisplay.as 2009-11-29 18:51:32 UTC (rev 376) @@ -20,6 +20,7 @@ { public var msg:String = ""; + public var gameObject:actionscript.Game = null; public var pages:ArrayCollection; public var minPagesRead:int; public var currentPageNumber:int; @@ -110,7 +111,7 @@ { var sdq:StrategyDesignQuestionC = new StrategyDesignQuestionC(); sdq.locations = locations; - sdq.roundService.getCurrentRound(); + sdq.setRound(gameObject.currentRound); sdq.loadFromQuestion(Question(tempQuestion)); sdq.id = "q"+question; Modified: mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-11-25 23:31:53 UTC (rev 375) +++ mentalmodels/trunk/flex/src/custom/FisheryExperimentCore.mxml 2009-11-29 18:51:32 UTC (rev 376) @@ -105,8 +105,9 @@ // // Important Variables // - public var currentModule:Module = null; - public var currentModuleNumber:int = 0; + public var gameObject:actionscript.Game = null; +// public var currentModule:Module = null; +// public var currentModuleNumber:int = 0; public var currentBlock:Block = null; public var currentBlockNumber:int = 0; [Bindable] public var locations:ArrayCollection = new ArrayCollection([newLocation(0, 0)]); @@ -134,6 +135,15 @@ { setBlock(event.message.body as actionscript.Block); } + else if(event.message.body is actionscript.Game) + { + gameObject = event.message.body as actionscript.Game; + setBlock(gameObject.currentBlock); + if(instructions != null) + { + instructions.setGameObject(this.gameObject); + } + } else if(event.message.body is ArrayCollection) { var students:ArrayCollection = new ArrayCollection(); Modified: mentalmodels/trunk/flex/src/custom/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-11-25 23:31:53 UTC (rev 375) +++ mentalmodels/trunk/flex/src/custom/InstructionPage.mxml 2009-11-29 18:51:32 UTC (rev 376) @@ -3,6 +3,7 @@ <mx:Script> <![CDATA[ + import actionscript.Game; import custom.questions.strategyDesign.StrategyDesignQuestionC; import custom.questions.dayByDayDecisions.DayByDayDecisionsQuestionC; import actionscript.Location; @@ -14,6 +15,7 @@ import actionscript.PageDisplay; import mx.collections.ArrayCollection; + [Bindable] public var gameObject:actionscript.Game = null; [Bindable] public var moduleNumber:int = 1; [Bindable] public var module:Module; [Bindable] public var blockNumber:int = 0; @@ -36,6 +38,15 @@ return newLoc; } + public function setGameObject(newGameObject:actionscript.Game):void + { + this.gameObject = newGameObject; + if(pageDisplay != null) + { + pageDisplay.gameObject = this.gameObject; + } + } + // public function initModule(newModule:actionscript.Module):void // { // module = newModule; @@ -83,6 +94,7 @@ pageDisplay = new PageDisplay(makeBlock(),0,locations); // Alert.show(debug2.text); } + setGameObject(this.gameObject); currPage = pageDisplay.currentPageNumber; numPages = pageDisplay.pages.length; Modified: mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml 2009-11-25 23:31:53 UTC (rev 375) +++ mentalmodels/trunk/flex/src/custom/SocioDemographicPage.mxml 2009-11-29 18:51:32 UTC (rev 376) @@ -37,7 +37,7 @@ var red:String = "#FF0000"; var white:String = "#FFFFFF"; - if(getGender().length != 1) // "M", "F", "Err" + if(getGender().length != 1) // possible genders are: "M", "F", "Err" { boxGender.setStyle(bgcolor, red); ready=false; Modified: mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-11-25 23:31:53 UTC (rev 375) +++ mentalmodels/trunk/flex/src/custom/questions/strategyDesign/StrategyDesignQuestionC.mxml 2009-11-29 18:51:32 UTC (rev 376) @@ -33,8 +33,8 @@ <mx:Label text="days before starting the next repetition."/> </mx:HBox> - <mx:RemoteObject id="roundService" destination="roundService" fault="faultHandler(event)"> - <mx:method name="getCurrentRound" result="roundResultHandler(event)"/> + <mx:RemoteObject id="GameService" destination="gameService" fault="faultHandler(event)"> + <mx:method name="getCurrentRoundNo" result="roundResultHandler(event)"/> </mx:RemoteObject> <mx:Script> @@ -63,9 +63,13 @@ public function roundResultHandler(event:ResultEvent):void { - repeated.round = notRepeated.round = event.result as Round; + setRound(event.result as Round); // Alert.show("Round received in StrategyDesign"); } + public function setRound(newRound:Round):void + { + repeated.round = notRepeated.round = newRound; + } public function faultHandler(event:FaultEvent):void { Alert.show("Error finding round for Strategy Design!"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |