1 Reply Latest reply on Jun 27, 2007 3:37 PM by JoMasta

    Class functions not able to see other member functions/variables?

      I am having a problem which has crept up on me a few times now. I am trying to call another member function within the same class, but Flash is unable to recognize it. This also happens when I try to read values of come variables.

      For example, here I am trying to set the private boolean member variable to the state of the checkbox.

      //NOTE: This is an EventListener. Does this change something major?

      private function CheckBoxClick( evt )
      _enabled = _root["test_sp"].content[_checkBoxName].selected;
      trace( _checkBoxName + " checked: " + _root["test_sp"].content[_checkBoxName]._y );

      This will output the following: "undefined checked: undefined"

      Now in the function directly above it, I have the following function:

      public function SetYPosition(pos:Number)
      trace( _checkBoxName );
      _root["test_sp"].content[_checkBoxName]._y = pos;

      And this function will correctly output the checkbox name as well as update the position.

      If I try adding the function call "SetYPosition(500);" to the first function (CheckBoxClick), the function will never be called as if Flash cannot see it.

      In the past I have avoided this by using the global instance of the class such as _global.settings.function(blah), but the class I am working on now does not have a global instance.

      Any ideas? This is really annoying!


        • 1. Class functions not able to see other member functions/variables?
          JoMasta Level 1
          So I was able to fix my problem of getting the checkbox's information by doing the following:

          private function CheckBoxClick( evt )
          _enabled = evt.target.selected;
          trace( _checkBoxName + " checked: " + _enabled );

          This outputs: "undefined checked: false"

          Is it at all possible to access member variables or other functions from within an event listening function?

          BTW: This _enabled does not seem to be affecting the member variable....it is creating a new variable it seems.