2 Replies Latest reply on Apr 20, 2010 5:16 PM by mumcs01

    Undefined relatedObject references


      So I'm trying to do something which I think I should be able to do. I'm using two groups of 3 radio buttons, and calling a function when either group changes. I"m trying to get the function to see the value selected and what radio button group its in, then call an external function (addavalue) to send off a value pair to be saved. The first value is to be the radiobuttongroup name with the text "_write" tacked on the end, followed by the word "enabled" as the second pair.


      My problem has nothing  to do with the external function call or the value pair but that i can't seem to reference the relatedObject class. I get the following compiler errors.

      "Access of possibly undefined property index through a reference with a static type flash.events:Event." (POinting to the if statement in my radioChange function).

      "Access of a possibily undefined property relatedObject through a reference with a static type flash.events:Event. (Pointing to the code in the if statement).


      According to the debugger variable list, the values are there???


      Any ideas?




      <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" borderStyle="solid"
         borderColor="#D4D4D4" dropShadowEnabled="true" dropShadowColor="#B3B3B3"
         shadowDirection="right" shadowDistance="10" >

         private function radioChange(event:Event):void
         if (event.relatedObject.value == "r") {
          parentDocument.addavalue(event.relatedObject.groupName + "_write","enabled");

      <mx:VBox id="rights_table">
         <mx:Label text="Device Configuration Folder:"/>
         <mx:RadioButtonGroup id="device_cfg" itemClick="radioChange(event)" />
         <mx:RadioButton groupName="device_cfg" label="Read" value="r" />
         <mx:RadioButton groupName="device_cfg" label="Write" value="w" />
         <mx:RadioButton groupName="device_cfg" label="Read/Write" value="rw" />
         <mx:Label text="Console Configuration Folder:"/>
         <mx:RadioButtonGroup id="console_cfg" itemClick="radioChange(event)"/>
         <mx:RadioButton groupName="console_cfg" label="Read" value="r" />
         <mx:RadioButton groupName="console_cfg" label="Write" value="w" />
         <mx:RadioButton groupName="console_cfg" label="Read/Write" value="rw" />