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, switcherfunc);
}
protected function switcherfunc(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?