0 Replies Latest reply on Jul 13, 2009 8:04 AM by Jerry62712

    Newbie - how to test with parms.

    Jerry62712 Level 1

      Last week I posted a multi-part question here.  It was multi-part because it was taking up to an hour to open a question or reply box.  That seems to be fixed so now I'm breaking the question out into its pieces in hopes of getting an answer.  One of the questions was answered by member rtalton (kudos and thanks!) on a good way to find if an element is in an XML object.  Several people have come up with a solution, but his (or hers) was the best one.

       

      On the question of debugging a Flex application it wasn't so clear, at least to me.  I have an application that will either be used via the web like anyother or be invoked from a program that will pass in the information for the fields.  That part works, but I have to put code into the application to set those fields.

       

      Flex has an option to put in parameters if I am reading this right.  You just go:

       

      Project -> Properties -> Run/Debug Settings

       

      Then you create a new launch configuration that would include the stuff you want.  But it doesn't work for me.  The default setting ("C:\Flex Builder 3\FSCalc\FSCalc\bin-debug\FSCalc.html") appears in Debug, Profile and Run.  I tried changing the Debug (seems like the logical one) setting to include a query string after the URL.  I saved it with a new name and when I execute the application I'm prompted for which launch configuration to use.

       

      Here is the modified string:

      C:\Flex Builder 3\FSCalc\FSCalc\bin-debug\FSCalc.html?xml=<?xml version="1.0" encoding="UTF-8" ?><FSParm><GrossMonthlyEarnedIncome>2000</GrossMonthlyEarnedIncome><GrossMonthlyOtherInco me>694</GrossMonthlyOtherIncome><HouseholdSize>6</HouseholdSize><QualifyingMember>true</Qu alifyingMember><SimplifiedProcessingUnitInd>true</SimplifiedProcessingUnitInd><DependentCa reCostsAmt>500</DependentCareCostsAmt><NumberOfChildrenUnder2></NumberOfChildrenUnder2><Nu mberOfChildrenOver2>1</NumberOfChildrenOver2><CourtOrderedSupportAmt>300</CourtOrderedSupp ortAmt><MedicalExpenseAmt>250</MedicalExpenseAmt><MonthlyRentOrMortgageAmt>250</MonthlyRen tOrMortgageAmt><MonthlyInsuranceAndTaxAmt>0</MonthlyInsuranceAndTaxAmt><UtilityType>liheap </UtilityType><TotalAssets>2999</TotalAssets></FSParm>

       

      Perhaps I'm using the wrong timing event.  The above is parsed by a routine (setInitApplication()) that is called from the MX application tag creationComplete event.  When this runs, I expected to see those values appear in the form (thus proving the querystring was parsed correctly.  I also tried the MX application tag initialize as it seems to execute earlier in the process (just incase creationComplete has already executed and so the values displayed are the defaults for each of the tags).

       

      Here is the MX tags:

      <mx:Application
        xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns:DHSComp="components.*"
        initialize="setInitAccessible();"
        backgroundColor="#dedacf"
        layout="absolute"
        borderStyle="inset"
        borderThickness="2"
        paddingLeft="10"
        paddingRight="10"
        paddingTop="10"
        paddingBottom="10"
        height="100%"
        verticalScrollPolicy="on">
      <!-- creationComplete="setInitAccessible();" -->

       

                  <mx:FormItem id="residenceSizeLabel"
                    label="Household Size"
                    required="true"
                    top="6" right="5"
                    horizontalAlign="right"
                    toolTip="Number of people in residence - 1 to 99 max - required">
                    <mx:NumericStepper id="residenceSizeData"
                      maximum="99"
                      minimum="1"
                      maxChars="2"
                      width="90"
                      tabEnabled="true" tabIndex="2"/>
                  </mx:FormItem>

       

       

      Here is the ActionScript (first one is in the xmxl file, second is an included script):

        <mx:Script>
            <![CDATA[
               
                public function setInitAccessible():void {
                  getXMLURL();
                   accessibleSet();
                }
            ]]>
        </mx:Script>

       

      public function getXMLURL():void {
          var FSURL:FSURLParse = new FSURLParse;

       

          if (FSURL.setQueryString()) {
              // we had an input stream
              calcOutputVariables();
              var x:String = buildPhoneResults();
              // this is for testing as the form won't be visible when
              // this is executed from the Tier phone application
              residenceSizeData.value = FSP.getResidenceSize();
              earnedIncomeData.value = FSP.getGrossIncomeAmount();
              otherIncomeData.value = FSP.getOtherIncome();
          };
      }

       

      What I expected was to see "6" in the residence size field, but I didn't.