I've been pulling teeth on this issue. An error is thrown whenever I try to perform a "_model.AddItem" call (or SharedCollection.AddItem ) whenever the ConnectSessionContainer fires the "synchronizationChange" event. The only time "_model.AddItem" works is after the program loads, and then I use a click event to then fire off "_model.AddItem" (code not shown).
In this case, you might actually have better luck debugging w/o the try/catch block, and just seeing where it lands in the source code.
Here's my suspicion : there are actually 2 levels of synchronization in a room :
1) is at the ConnectSession level - this synchronizes the list of collectionNodes, as well as all users, files, streams, and roomSettings.
2) is at the level of each individual collectionNode. The idea here is that most apps won't want to subscribe to every possible model in the room right at the outset, so it's expected that the developer will explicitly subscribe to the ones needed.
So the problem here seems to be that, while the top level of the room is synched, your models within it aren't ready yet. here's what I'd suggest :
a) for your synchronizationChange handler for ConnectSession, have it create your model, ask it to subscribe, and listen to its synchronizationChange event.
b) in its synchChange event, have it do what sendMessage() does today.
Technically, you can ask the sharedCollection (or any sharedModel) to subscribe at any time - you don't have to wait for the ConnectSession to synch. I just hung it there since you need to use script to do it somewhere; applicationComplete would work just as well.
I would use my debugger, but currently getting some weird message: "C:\Windows\System32\Macromed\Flash\NPSWF32.dll ..Flex Builder cannot locate the required debugger version of Flash Player. You might need to install the debugger version of Flash Player 9 or reinstall Flex Builder. "
Anyway, I tried your suggestion, and it didn't work. See below. Let me know if you have any other ideas. I tried handling SYNCHRONIZATION_CHANGE and COLLECTION_CHANGE.
The bug in your code is that you've got the synchChange listener set up on _model.connectSession. That's just the connectSession's synchChange again. try _model.addEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE, modelSynchronizationChange).