There is a similar post here regarding this issue, but my problem is a little different.
I have a PopUp window containing a form used to sign-up for access to a site. An event is generated from the PopUp via a Mate Dispatcher tag (Figure 1) validated in Flex and then sent to the server. Validation happens both in Flex and on the remote server via an ActionScript 3 (AS3) script.
(Figure 1 : Dispatcher in PopUp)
<mate:Dispatcher id="dispatcher">
<mate:ResponseHandler
type="{AccountEvent.CREATE_ACCOUNT_RESPONSE}"
response="onCreateAccountResponse(event)"/>
</mate:Dispatcher>
If validation fails on the Flex side, the method returns the errors (via lastReturn) to a Mate EventMap (Figure2) where a ResponseHandler sends the errors back to the PopUp and the server is not called; so far so good.
(Figure 2: Account EventMap)
<EventHandlers type="{AccountEvent.CREATE_ACCOUNT}" debug="true">
<MethodInvoker
generator="{AccountManager}"
method="createAccount"
arguments="{event}"/>
<ResponseAnnouncer
generator="{AccountEvent}"
type="{AccountEvent.CREATE_ACCOUNT_RESPONSE}">
<Properties result="{lastReturn}"/>
</ResponseAnnouncer>
</EventHandlers>
The server response is handled in an AS3 script and dispatched back to the PopUp via a listener tag which is located in the PopUp (Figure 3).
(Figure 3 : Listener in PopUp component)
<mate:Listener
type="{AccountEvent.CREATE_ACCOUNT_RESPONSE}"
method="onCreateAccountResponse"
/>
The problem is after the server responds, and the listener tag (Figure 3) receives the event, I get run-time errors saying the objects are null (and they are) but why are the objects null? It appears that all objects in the PopUp are set to null. Even though 1) the PopUp was never closed, 2) The process is generated from the PopUp 3) The Listener tag in the PopUp receives the event.
It's not as if I am creating the PopUp after receiving server results, the PopUp already exists. I thought, perhaps a new instance of the PopUp is being created. I put breaks on the creationComplete, show and initialize event methods and they did not fire, but yet all components are set to null. After clearing the errors, the form values are still there and I can submit the form again. Yet the button object says it's null.
Any ideas?