Component not listening to MainApp's state change

Posted by tag on Stack Overflow See other posts from Stack Overflow or by tag
Published on 2010-05-02T12:39:53Z Indexed on 2010/05/02 12:47 UTC
Read the original article Hit count: 143

Filed under:
|
|

I don't know if this is too difficult or too easy. My custom component is trying to listen to the main application's state changes using StateChangeEvent.CURRENT_STATE_CHANGE

private function init(){
      addEventListener(StateChangeEvent.CURRENT_STATE_CHANGE, function():void{
         Alert.show("parent state changed"); 
      });
}

but as expected, it's reporting its own state changes not the main application's.

I have 2 options:

  • figure a way to tell it that I really mean the main application's state change not its own
  • or configure the main application to dispatch a specific custom event that the component would listen for

Any idea how I could do the first? or do I need the second option in this case?

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flex