0 Replies Latest reply on Oct 12, 2009 1:37 PM by FALCONSEYE_

    Flex Combobox and "Access of undefined property ..." error

    FALCONSEYE_

      I am kind of puzzled and not sure how to tackle this issue: Got two comboxes with dataproviders. Also, I created a separate index.as in /as folder. I have these two functions:

       

      In my .mxml page, I have :

                <mx:FormItem label="Property Code:" id="fi_propertyCode"  width="100%">
                      <mx:ComboBox id="propertyCode"  width="50%" dataProvider="{qry_communites}" change="showPropertyCode()" />
                    </mx:FormItem>
                   
                    <mx:FormItem label="Utility Type:" id="fi_utilityType" width="100%">
                        <mx:ComboBox id="utilityType"  width="50%" dataProvider="{qry_utilityTypes}" change="showUtilityType()" />
                  </mx:FormItem>

      and in my index.as, I have:

       

      private function showPropertyCode():void {
          mx.controls.Alert.show(propertyCode.selectedItem.label, propertyCode.selectedItem.data);
      }

       

      private function showUtilityType():void {
          mx.controls.Alert.show(utilityType.selectedItem.label, utilityType.selectedItem.data);
      }

       

      I get an error saying

      Access of undefined property utilityType.

       

      The funny thing is I don't get this error for "propertyCode". Moreover, If I copy pasyte showUtilityType() function and put inside my .mxml page, I don't get this error either. Btw. I have :

      <mx:Script>
              <![CDATA[
                  include "../as/index.as";

            ....

      </mx:Script>

       

      in my .mxml page. What should I do? How can I get rid of this error? Why does Flex see propertyCode combobox but not utilityType combobox? I would rather keep index.as as it is. Thanks in advance.