Item Renderer having trouble updating

Posted by duder on Stack Overflow See other posts from Stack Overflow or by duder
Published on 2010-06-07T05:47:53Z Indexed on 2010/06/07 5:52 UTC
Read the original article Hit count: 352

Filed under:
|
|
|
|

I have a list ItemRenderer that has 2 states. When it initializes, I set it to 1 state and listen for an event that switches it to state 2.

protected function onCreationComplete(event:FlexEvent):void{
   currentState = "state1";
   addEventListener(CustomEvent.Event1, switch);
}

protected function switch(event:FlexEvent):void{
   currentState = "state2";
}

The difference between the 2 states is that I hide/show some labels.

The problem is that it doesn't work. I still see the visual of the old state, even though if I Alert.show(currentState), it shows the correct state name.

I've tried adding the line invalidateDisplayList(); inside the switch function but still no luck.

protected function switch(event:FlexEvent):void{
   currentState = "state2";
   invalidateDisplayList();
}

What am I doing wrong. Any ideas how I can get this ItemRenderer to really update?

© Stack Overflow or respective owner

Related posts about flex

Related posts about actionscript-3