[virtualcommons-svn] SF.net SVN: virtualcommons:[152] mentalmodels/trunk/flex/src
Status: Beta
Brought to you by:
alllee
From: <kj...@us...> - 2009-06-02 22:37:12
|
Revision: 152 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=152&view=rev Author: kjonas Date: 2009-06-02 22:37:05 +0000 (Tue, 02 Jun 2009) Log Message: ----------- FisheryExperimentKalin is a working Demo to be displayed to Robert Tobias the only section that does not work quite as intended is the final section, Forecasting. I am working to manage this. all *QuestionComponents were fitted title and description fields. PsychometricQuestionC must have .initialize and .init() called in order to display properly Modified Paths: -------------- mentalmodels/trunk/flex/src/FisheryExperimentKalin.mxml mentalmodels/trunk/flex/src/QuestionTest.mxml mentalmodels/trunk/flex/src/_InstructionsTest.mxml mentalmodels/trunk/flex/src/customComponents/Forecast2.mxml mentalmodels/trunk/flex/src/customComponents/InstructionPage.mxml mentalmodels/trunk/flex/src/customComponents/InstructionPage_TEMP.mxml mentalmodels/trunk/flex/src/customComponents/PlannerPage.mxml mentalmodels/trunk/flex/src/customComponents/PsychometricQuestionC.mxml mentalmodels/trunk/flex/src/customComponents/Slider.mxml mentalmodels/trunk/flex/src/customComponents/SocioDemographicPage.mxml Added Paths: ----------- mentalmodels/trunk/flex/src/customComponents/CategoricalQuestionC.mxml mentalmodels/trunk/flex/src/customComponents/ForecastPage_TEMP.mxml mentalmodels/trunk/flex/src/customComponents/TextQuestionC.mxml Modified: mentalmodels/trunk/flex/src/FisheryExperimentKalin.mxml =================================================================== --- mentalmodels/trunk/flex/src/FisheryExperimentKalin.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/FisheryExperimentKalin.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -1,16 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.*" - backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #80FFAA]" + backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #B0B0FF]" width="760" height="510" clipContent="false" layout="absolute" - currentState="instructions" initialize="init()"> + currentState="socioDemographic" initialize="init()"> <mx:states> - <mx:State name="instructions"> - <mx:AddChild relativeTo="{content}"> - <comp:InstructionPage id="instructions"/> - </mx:AddChild> - </mx:State> - <mx:State name="socioDemographic"> <mx:AddChild relativeTo="{content}"> <comp:SocioDemographicPage id="socioDemographic" x="265" y="100"/> @@ -23,7 +17,20 @@ </mx:AddChild> </mx:State> - <mx:State name="none"/> + <mx:State name="instructions"> + <mx:AddChild relativeTo="{content}"> + <comp:InstructionPage_TEMP id="instructions"/> + </mx:AddChild> + </mx:State> + + <mx:State name="forecasting"> + <mx:AddChild relativeTo="{content}"> + <comp:ForecastPage_TEMP id="forecasting"/> + </mx:AddChild> + </mx:State> + + <mx:State name="none"> + </mx:State> </mx:states> @@ -69,25 +76,25 @@ { Id = event.result as uint; - Alert.show("Student id is " + Id ); +// Alert.show("Student id is " + Id ); consumer.disconnect(); } private function faultHandler(event:FaultEvent):void { - Alert.show("event fault is " + event.fault.faultDetail); +// Alert.show("event fault is " + event.fault.faultDetail); } private function handleFault(event:MessageFaultEvent):void { - Alert.show("Message event fault is " + event.faultString); +// Alert.show("Message event fault is " + event.faultString); } private function messageHandler(message:IMessage):void { randomNumbers = message.body as String; - Alert.show( ""+randomNumbers); +// Alert.show( ""+randomNumbers); } public function init():void @@ -175,6 +182,10 @@ { (InstructionPage)(obj).forward(); } + if(obj is ForecastPage_TEMP) + { + (ForecastPage_TEMP)(obj).forward(); + } return false; } @@ -184,17 +195,6 @@ { return false; } var obj:DisplayObject = content.getChildAt(0); - if(obj is InstructionPage) - { - if( (InstructionPage)(obj).accept() ) - { - obj.visible = false; - expiredContent.addChild(obj); - currentState = "socioDemographic"; - //consumer.subscribe(); - return true; - } - } if(obj is SocioDemographicPage) { var Id:uint = 0; @@ -210,7 +210,7 @@ Alert.show(info.getSemester()); Alert.show(info.getYear());*/ Id=ss.createStudent(info.getYear(), info.getSemester(), info.getGender(),info.getMajor()); - Alert.show("Before invoking createstudent()"); +// Alert.show("Before invoking createstudent()"); return true; } } @@ -220,11 +220,33 @@ { obj.visible = false; expiredContent.addChild(obj); - currentState = "none"; + currentState = "instructions"; return true; } } + if(obj is InstructionPage_TEMP) + { + if( (InstructionPage_TEMP)(obj).accept() ) + { + obj.visible = false; + expiredContent.addChild(obj); + currentState = "forecasting"; + //consumer.subscribe(); + return true; + } + } + if(obj is ForecastPage_TEMP) + { + if( (ForecastPage_TEMP)(obj).accept() ) + { + obj.visible = false; + expiredContent.addChild(obj); + currentState = "none"; + //consumer.subscribe(); + return true; + } + } return false; } Modified: mentalmodels/trunk/flex/src/QuestionTest.mxml =================================================================== --- mentalmodels/trunk/flex/src/QuestionTest.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/QuestionTest.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -40,8 +40,8 @@ </mx:ArrayCollection> </mx:ArrayCollection> - <comp:TextQuestion id="question1"/> - <comp:CategoricalQuestion id="question2" topics="{topicList}" specifics="{specificList}"/> + <comp:TextQuestionC id="question1"/> + <comp:CategoricalQuestionC id="question2" topics="{topicList}" specifics="{specificList}"/> <comp:ForecastQuestion id="question3"/> </mx:Application> Modified: mentalmodels/trunk/flex/src/_InstructionsTest.mxml =================================================================== --- mentalmodels/trunk/flex/src/_InstructionsTest.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/_InstructionsTest.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -9,31 +9,43 @@ public var choices1:ArrayCollection = new ArrayCollection(); public var questions1:ArrayCollection = new ArrayCollection(); - public var questionGroups:ArrayCollection = new ArrayCollection(); + public var choices2:ArrayCollection = new ArrayCollection(); + public var questions2:ArrayCollection = new ArrayCollection(); + + public var questionGroups1:ArrayCollection = new ArrayCollection(); public var block1:Block = new Block(); public function fillBlock():void { try{ // debg.text += "creating choices\n"; - choices1.addItem("Test1"); - choices1.addItem("Test2"); - choices1.addItem("Test3"); + choices1.addItem("Highly Agree"); + choices1.addItem("Highly Neutral"); + choices1.addItem("Highly Disagree"); + + choices2.addItem("Agree"); + choices2.addItem("Neutral"); // debg.text += "choices1.length="+choices1.length+"\n"; // debg.text += "creating questions\n"; questions1.addItem(new PsychometricQuestion()); PsychometricQuestion(questions1.getItemAt(0)).choices = choices1; - PsychometricQuestion(questions1.getItemAt(0)).numberOfIntervals = 5; + PsychometricQuestion(questions1.getItemAt(0)).numberOfIntervals = 3; + + questions2.addItem(new PsychometricQuestion()); + PsychometricQuestion(questions2.getItemAt(0)).choices = choices2; + PsychometricQuestion(questions2.getItemAt(0)).numberOfIntervals = 5; // debg.text += "questions1.length="+questions1.length+"\n"; // debg.text += "creating questiongroups\n"; - questionGroups.addItem(new QuestionGroup()); - QuestionGroup(questionGroups.getItemAt(0)).questions = questions1; + questionGroups1.addItem(new QuestionGroup()); + questionGroups1.addItem(new QuestionGroup()); + QuestionGroup(questionGroups1.getItemAt(0)).questions = questions1; + QuestionGroup(questionGroups1.getItemAt(1)).questions = questions2; // debg.text += "questionGroups.length="+questionGroups.length+"\n"; // debg.text += "creating block\n"; - block1.questionGroups = questionGroups; + block1.questionGroups = questionGroups1; // debg.text += "block1.questionGroups.length="+block1.questionGroups.length+"\n"; // debg.text += "finished\n"; @@ -52,7 +64,7 @@ <mx:String>testRight</mx:String> </mx:ArrayCollection> <comp:PsychometricQuestionC id="psych" labels="{labs}" initialize="true"/> - <comp:CategoricalQuestion/> + <comp:CategoricalQuestionC/> <mx:Button id="forward" click="iPage.forward()" label="forward"/> <mx:Button id="back" click="iPage.back()" label="back"/> Added: mentalmodels/trunk/flex/src/customComponents/CategoricalQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/CategoricalQuestionC.mxml (rev 0) +++ mentalmodels/trunk/flex/src/customComponents/CategoricalQuestionC.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:as="actionscript.*"> + <mx:Script> + <![CDATA[ + import actionscript.FishUtil; + + private function fix(index:int, list:ArrayCollection):int + { + return FishUtil.fix(index, list); + } + + ]]> + </mx:Script> + + <mx:String id="title"></mx:String> + <mx:String id="description"></mx:String> + <mx:VBox id="headers"> + <mx:Label/> + <mx:Label htmlText="{htmlBold(title)}"/> + <mx:Text htmlText="{description}"/> + </mx:VBox> + <mx:Script> <![CDATA[ + public function htmlBold(str:String):String + { + if(str==null)return null; + return "<font size=\"12px\">" + str + "</font>"; + } + ]]> </mx:Script> + + <mx:HBox id="content"> + <mx:ComboBox id="comboTopic" + dataProvider="{topics}" selectedIndex="0"/> + <mx:ComboBox id="comboSpecific" + dataProvider="{specifics.getItemAt(fix(comboTopic.selectedIndex, specifics))}"/> + </mx:HBox> + + <!-- the selected element of this array determines which of the elements of + "specifics" will be used as the dataProvider --> + <mx:ArrayCollection id="topics"> + <mx:String>- Select -</mx:String> + <mx:String>topic1</mx:String> + <mx:String>topic2</mx:String> + <mx:String>topic3</mx:String> + </mx:ArrayCollection> + + <!-- each element of this ArrayCollection will serve as a dataProvider --> + <mx:ArrayCollection id="specifics"> + <mx:ArrayCollection id="topic0"> + </mx:ArrayCollection> + <mx:ArrayCollection id="topic1"> + <mx:String>- Select -</mx:String> + <mx:String>specific1.0</mx:String> + <mx:String>specific1.1</mx:String> + <mx:String>specific1.2</mx:String> + </mx:ArrayCollection> + <mx:ArrayCollection id="topic2"> + <mx:String>- Select -</mx:String> + <mx:String>specific2.0</mx:String> + <mx:String>specific2.1</mx:String> + <mx:String>specific2.2</mx:String> + </mx:ArrayCollection> + <mx:ArrayCollection id="topic3"> + <mx:String>- Select -</mx:String> + <mx:String>specific3.0</mx:String> + <mx:String>specific3.1</mx:String> + <mx:String>specific3.2</mx:String> + </mx:ArrayCollection> + </mx:ArrayCollection> + +</mx:VBox> Modified: mentalmodels/trunk/flex/src/customComponents/Forecast2.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/Forecast2.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/customComponents/Forecast2.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -261,6 +261,21 @@ } } + public function isFinished():Boolean + { + for(var col:Number=0; col < numColumns; col++) + { + for(var x:Number = 0; x < numFields; x++) + { + if(getItem(x, col) <= 0) + { + return false; + } + } + } + return true; + } + ]]> </mx:Script> Added: mentalmodels/trunk/flex/src/customComponents/ForecastPage_TEMP.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/ForecastPage_TEMP.mxml (rev 0) +++ mentalmodels/trunk/flex/src/customComponents/ForecastPage_TEMP.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="customComponents.*" xmlns:as="actionscript.*"> + + <mx:VBox id="content"> + <comp:Forecast1 id="forecastPeople" numColumns="15" minValue="0" maxValue="30"/> + <!--<mx:Button id="next" label="Forecast Fish Movements" click="testNext()"/>--> + </mx:VBox> + + <mx:Script> + <![CDATA[ + import customComponents.*; + import mx.collections.ArrayCollection; + import mx.controls.Alert; + + private var clicks:int = 0; + + public function testNext(evt:Event=null):Boolean + { + clicks++; + if(!(forecastPeople.isFinished() || clicks > 1)) + { + Alert.show("Not finished forecasting Predictions of People. Click again to disregard."); + return false; + } + if(clicks > 2) return false; + var f2:Forecast2 = new Forecast2(); + f2.id = "forecastFull_AS"; + f2.numColumns = 6; + f2.oldForecast1 = forecastPeople; + content.addChild(f2); + return true; + } + + public function back():Boolean + { + return false; + } + + public function forward():Boolean + { + return testNext(); + } + + public function accept():Boolean + { + if(forecastPeople.isFinished()) + { + var forecastFish:Forecast2 = content.getChildAt(1) as Forecast2; + return forecastFish.isFinished(); + } + return false; + } + + ]]> + </mx:Script> + +</mx:Canvas> Modified: mentalmodels/trunk/flex/src/customComponents/InstructionPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/InstructionPage.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/customComponents/InstructionPage.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -43,12 +43,28 @@ public function back():Boolean { - return pageDisplay.prevPage(); + var pageSuccess:Boolean = pageDisplay.prevPage(); + currPage = pageDisplay.currentPageNumber; + currPageLabel.text = "Page " + (currPage+1) + " / " + numPages; + if(pageSuccess) + { + content.removeAllChildren(); + content.addChild(pageDisplay.currentPage); + } + return pageSuccess; } public function forward():Boolean { - return pageDisplay.nextPage(); + var pageSuccess:Boolean = pageDisplay.nextPage(); + currPage = pageDisplay.currentPageNumber; + currPageLabel.text = "Page " + (currPage+1) + " / " + numPages; + if(pageSuccess) + { + content.removeAllChildren(); + content.addChild(pageDisplay.currentPage); + } + return pageSuccess; } public function accept():Boolean @@ -67,8 +83,7 @@ ]]> </mx:Script> - <mx:Label text="{currPage+1}"/> - <mx:Label text="{numPages}"/> + <mx:Label id="currPageLabel" text="Page {(currPage+1)} / {numPages}"/> <mx:Text id="debug" text="{pageDisplay.msg}" width="300"/> <mx:VBox id="content"/> Modified: mentalmodels/trunk/flex/src/customComponents/InstructionPage_TEMP.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/InstructionPage_TEMP.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/customComponents/InstructionPage_TEMP.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -1,23 +1,89 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="customComponents.*" xmlns:as="actionscript.*"> +<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="customComponents.*" xmlns:as="actionscript.*" initialize="init()"> - <mx:ArrayCollection id="pageSet1"> - + <mx:ArrayCollection id="psychometricLabels"> + <mx:String>Very Much</mx:String> + <mx:String>Neutral</mx:String> + <!--<mx:String>Not at All</mx:String>--> </mx:ArrayCollection> - <mx:VBox id="p1"> - <mx:Text text="This is an information window." width="300"/> - <mx:Text text="What is presented in an information window can be selected from the drop-down list above each window!" width="300"/> - <mx:Text text="Please check the options of the drop-down list when entering a new module of the experiment (i.e. after leaving a module by clicking on “Accept”)." width="300"/> - </mx:VBox> - <mx:VBox id="p2"> - <mx:Text text="num2" width="300"/> - </mx:VBox> - <mx:VBox id="p3"> - <mx:Text text="Welcome to the E-Fishery experiment" width="300"/> - <mx:Text text="In this experiment you will design a strategy to fish an abstract fishing ground together with three other persons. As we are mainly interested in the reasons why you choose a certain strategy, we will ask you a number of questions. For the same reason, there are no ‘correct’ or ‘wrong’ strategies and no ‘correct’ or ‘wrong’ answers. However, since for each pound of fish you get during the experiment you will receive #.### US$, you might be interested in finding a strategy that fits your goals well. For this, you have to understand the dynamics of the (simulated) fish population and anticipate well the behavior of the other persons of your group." width="300"/> - </mx:VBox> + <mx:ArrayCollection id="categoricalTopics"> + <mx:String>- Select -</mx:String> + <mx:String>Your Earnings</mx:String> + <mx:String>Fish Population</mx:String> + <mx:String>Other Players</mx:String> + </mx:ArrayCollection> - <!--<as:PageDisplay pages="{pageSet1}"/>--> + <mx:ArrayCollection id="categoricalSpecifics"> + <mx:ArrayCollection> + </mx:ArrayCollection> + <mx:ArrayCollection> + <mx:String>- Select -</mx:String> + <mx:String>Earn as much as possible</mx:String> + <mx:String>Earn more than the others</mx:String> + <mx:String>Earn about the same as the others</mx:String> + <mx:String>Earn less then the others</mx:String> + <mx:String>Earn a fair amount but much less then would be possible</mx:String> + <mx:String>Earn nothing</mx:String> + </mx:ArrayCollection> + <mx:ArrayCollection> + <mx:String>- Select -</mx:String> + <mx:String>Let the fish population grow as much as possible</mx:String> + <mx:String>Keep the fish population at a high stable level</mx:String> + <mx:String>Keep the fish population at a medium stable level</mx:String> + <mx:String>Keep the fish population at a low stable level</mx:String> + <mx:String>Not to completely destroy the fish population</mx:String> + <mx:String>To destroy the fish population</mx:String> + </mx:ArrayCollection> + <mx:ArrayCollection> + <mx:String>- Select -</mx:String> + <mx:String>Act similarly to the others</mx:String> + <mx:String>Act differently than the others</mx:String> + <mx:String>Allow the others to have good earnings</mx:String> + <mx:String>Avoid that the others get good earnings</mx:String> + <mx:String>Act according to rules I expect the others to know</mx:String> + <mx:String>Act against rules I expect the others to know</mx:String> + </mx:ArrayCollection> + </mx:ArrayCollection> + <mx:HBox> + <mx:VBox> + <mx:Label/> + </mx:VBox> + <mx:VBox id="p1"> + <mx:Text htmlText="<b><font size="16">Sample Questions</font></b>" width="300"/> + <comp:PsychometricQuestionC id="psychometricQuestion" title="Overall, how much do you like your group?" + labels="{psychometricLabels}" maxValue="3"/> + <comp:CategoricalQuestionC id="categoricalQuestion" title="What goals did you follow when designing your strategy?" + topics="{categoricalTopics}" specifics="{categoricalSpecifics}"/> + <comp:TextQuestionC id="textQuestion" title="Describe in your own words what the rule, agreement, or other coordination attempt states." + defaultText="Enter your response here..." txtHeight="48"/> + </mx:VBox> + </mx:HBox> + + <mx:Script> + <![CDATA[ + + public function init():void + { + psychometricQuestion.initialize(); + psychometricQuestion.init(); + } + + public function back():Boolean + { + return false; + } + public function forward():Boolean + { + return false; + } + public function accept():Boolean + { + return true; + } + + ]]> + </mx:Script> + </mx:Canvas> Modified: mentalmodels/trunk/flex/src/customComponents/PlannerPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/PlannerPage.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/customComponents/PlannerPage.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="customComponents.*"> - <mx:Label text="Planning Stage" fontSize="24"/> + <mx:Label text="Strategy Design" fontSize="24"/> <mx:Text text="Please create a plan for the month. You will visit each of the locations listed in the left column in order. You will then do the same using the right column, and repeat until the 30 days are completed. If you do not manage to mine enough fish after one repetition, you may wait a few days until fishing again." width="600"/> <mx:Label/> Modified: mentalmodels/trunk/flex/src/customComponents/PsychometricQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/PsychometricQuestionC.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/customComponents/PsychometricQuestionC.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -1,14 +1,31 @@ <?xml version="1.0" encoding="utf-8"?> -<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="customComponents.*"> +<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comp="customComponents.*" initialize="false"> - <!-- Used for bipolar psychometric scales --> - <mx:Label id="topleft" text="topleft" x="0" y="0" width="100" textAlign="left" visible="false"/> - <mx:Label id="topmid" text="topmid" x="150" y="0" width="100" textAlign="center" visible="false"/> - <mx:Label id="topright" text="topright" x="300" y="0" width="100" textAlign="right" visible="false"/> + <mx:String id="title"></mx:String> + <mx:String id="description"></mx:String> + <mx:VBox id="headers"> + <mx:Label/> + <mx:Label htmlText="{htmlBold(title)}"/> + <mx:Text htmlText="{description}"/> + </mx:VBox> + <mx:Script> <![CDATA[ + public function htmlBold(str:String):String + { + if(str==null)return null; + return "<font size=\"12px\">" + str + "</font>"; + } + ]]> </mx:Script> - <!-- Used for unipolar psychometric scales --> - <mx:Label id="farleft" text="farleft" x="0" y="0" width="100" textAlign="center" visible="false"/> - <mx:Label id="farright" text="farright" x="300" y="0" width="100" textAlign="center" visible="false"/> + <mx:Canvas id="content" minHeight="30" maxHeight="90"> + <!-- Used for bipolar psychometric scales --> + <mx:Label id="topleft" text="topleft" x="0" y="0" width="100" textAlign="left" visible="false"/> + <mx:Label id="topmid" text="topmid" x="150" y="0" width="100" textAlign="center" visible="false"/> + <mx:Label id="topright" text="topright" x="300" y="0" width="100" textAlign="right" visible="false"/> + + <!-- Used for unipolar psychometric scales --> + <mx:Label id="farleft" text="farleft" x="0" y="0" width="100" textAlign="center" visible="false"/> + <mx:Label id="farright" text="farright" x="300" y="0" width="100" textAlign="center" visible="false"/> + </mx:Canvas> <mx:Script> <![CDATA[ @@ -30,14 +47,14 @@ farright.text = (String)(labels.getItemAt(1)); farleft.visible = true; farright.visible = true; - removeChild(topleft); - removeChild(topmid); - removeChild(topright); + content.removeChild(topleft); + content.removeChild(topmid); + content.removeChild(topright); slider1.isBipolar = false; slider1.x = 100; slider1.y = 0; } - else + else if(labels.length == 3) { topleft.text = (String)(labels.getItemAt(0)); topmid.text = (String)(labels.getItemAt(1)); @@ -45,24 +62,29 @@ topleft.visible = true; topmid.visible = true; topright.visible = true; - removeChild(farleft); - removeChild(farright); + content.removeChild(farleft); + content.removeChild(farright); slider1.isBipolar = true; slider1.x = 0; slider1.y = 36; } - slider1.maxValue = maxValue; - slider1.initialize(); - slider1.init(); - addChild(slider1); -/* var e:Error = new Error(); -e.message = "TEST"; -throw e; */ + initializeSlider(); } } + public function initializeSlider():void + { + slider1.maxValue = maxValue; + slider1.initialize(); + slider1.init(); + if(!(content.contains(slider1))) + { + content.addChild(slider1); + } + } + ]]> </mx:Script> -</mx:Canvas> +</mx:VBox> Modified: mentalmodels/trunk/flex/src/customComponents/Slider.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/Slider.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/customComponents/Slider.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -4,6 +4,7 @@ <mx:Script> <![CDATA[ import mx.controls.Label; + import mx.controls.Text; [Bindable] [Embed(source="../images/SliderImage.png")] @@ -55,7 +56,7 @@ for(var i:Number = 0; i < numTicks; i++) { var tick:Label = new Label(); - tick.text = "."; + tick.htmlText = "<b>.</b>"; tick.x = i*separation - imageWidth/2; tick.y = -10; addChild(tick); @@ -110,7 +111,7 @@ <!-- change X value to 1/2 the width of the sliderButton image --> <mx:HBox id="sliderBar" height="3" x="0" y="15" - borderStyle="solid" borderColor="#F0F0F0" borderThickness="2" + borderStyle="solid" borderColor="#000000" borderThickness="1" /> <mx:Image id="sliderButton" x="0" y="0" source="{sliderImage}"/> Modified: mentalmodels/trunk/flex/src/customComponents/SocioDemographicPage.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/SocioDemographicPage.mxml 2009-06-02 00:53:24 UTC (rev 151) +++ mentalmodels/trunk/flex/src/customComponents/SocioDemographicPage.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -37,7 +37,7 @@ boxGender.setStyle("backgroundColor", ""); } - if(getYear().length != 4) + if(getYear().length != 4 || Number(getYear()) < 1900) { txtYear.setStyle("backgroundColor", "#FF0000"); ready=false; Added: mentalmodels/trunk/flex/src/customComponents/TextQuestionC.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/TextQuestionC.mxml (rev 0) +++ mentalmodels/trunk/flex/src/customComponents/TextQuestionC.mxml 2009-06-02 22:37:05 UTC (rev 152) @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"> + + <!--<mx:String id="title"></mx:String> + <mx:String id="description"></mx:String> + <mx:VBox id="headers" paddingBottom="-3"> + <mx:Label text="{title}" paddingBottom="-8"/> + <mx:Text text="{description}" paddingBottom="-8"/> + </mx:VBox>--> + <mx:String id="title"></mx:String> + <mx:String id="description"></mx:String> + <mx:VBox id="headers"> + <mx:Label/> + <mx:Label htmlText="{htmlBold(title)}"/> + <mx:Text htmlText="{description}"/> + </mx:VBox> + <mx:Script> <![CDATA[ + public function htmlBold(str:String):String + { + if(str==null)return null; + return "<font size=\"12px\">" + str + "</font>"; + } + ]]> </mx:Script> + + <mx:Number id="txtWidth">200</mx:Number> + <mx:Number id="txtHeight">24</mx:Number> + <mx:String id="defaultText"/> + <mx:TextArea id="text" text="{defaultText}" width="{txtWidth}" height="{txtHeight}"/> + + <mx:Script> + <![CDATA[ + + public function back():Boolean + { + return false; + } + public function forward():Boolean + { + return false; + } + public function accept():Boolean + { + return true; + } + + ]]> + </mx:Script> + +</mx:VBox> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |