Me and my team are developing a big application and ran into some strange problems.
We are using an mxml-File to layout one of our screens containing some custom components.
After creationComplete appears and the user selects an workitem VO we feed
the custom components with the data to apply and show some alternating behaviour.
The Problem was that one of the custom components appears to be randomly null during
runtime. As example we call some methodes of the component, everything works.
Then an other one and the component throws an null-pointer exception. Debug-Mode
tells us that the component itself is null. Until now we had no chance to find out why this is
happening, so we tried to recreate the missing component when it was null.
Problem is the definition of the component contains a lot of bindings and relations to other components that
are relativly painful to set in actionscript. So my Question is if there is a possibility to reinitialize
a mxml-file? I didn't find anything on this topic.
Thx in advance!
Well, I suspect there is a lot going on.
You can force the component to refresh by calling invalidateDisplayList(). You can force it to resize itself using invalidateSize(). You can force the componen to re-evaluate properties using invalidateProperties().
If data you're passing into the component is null, though, I wouldn't expect any of those things to address the issue.
You can also create a new instance of your custom component and add it to your container. That will, definitely, reinitialize everything.
Without seeing any of your code, it's hard to pinpoint what could be the error.
Hi Jeffry! Thx for your reply. Unfortunately all the things you are pointing out are not new to me. I guess the real problem is that i can't explain how a component defined in a mxml file can suddently become null (after creationComplete and without being set to null ) again. I will post if i finde out something.