1 person found this helpful
In 4.5 there is a getCurrentRendererState() method.
Okay heres what i did:
protected override function getCurrentRendererState():String
The trace above returns "normal" which is by the book. I also have a normal state defined in states of the custom renderer, but nothing is included inside it The program flow actually hits return "selectionState" statement.
i would use the getCurrentRendererState inside the overriden data property like this: this.currentState = getCurrentRendererState();
Unfortunately when data is set is still throws the null reference errors on component references because the state was still not set correctly.
does this.currentState or setCurrentState work async? Because if i trace the state i see its actually the correct state, but all the references to states components are null. I used includeIn="stateName" for all components. Then i added itemCreationPolicy="immediate" and it works, but i wonder if all the components are created immedietely (even if they arent in the state that is active at the moment; if thats true, i kind of loose the point of having states in this case).
Hmm, its not a good solution, because everytime data property is set, all the bindings fire off, even those in inactive states, because the components have been initialized, but since the objects type isnt the right one, casting fails, grrrr :>
Forget it, im going with itemRendererFunction