Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges


SharedCollection.AddItem issue


Level 2
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).

I'm getting error: "*err.errorID:1009*err.Message:Error

private function sendMessage(p_evt:SessionEvent):void


if (p_evt.type == SessionEvent.ERROR) {

notificationMessage.text = "Error: " + p_evt.error;



if (p_evt.type == SessionEvent.SYNCHRONIZATION_CHANGE) {

if (cSession.isSynchronized) {"Connected");

try {

if (_model.connectSession.isSynchronized) {

_model.addItem({FirstName:"John12",LastName:"Austin12"}); }

else {"Model out of synch");


} catch (err:Error) {"*err.errorID:"+err.errorID+"*err.Message:"+err.message+"*""*err.getStackTrace:"+err.getStackTrace());





sendMessage is called via the below synchronizationChange

<rtc:ConnectSessionContainer roomURL="myroomURL"

id="cSession" authenticator="{auth}" height="187"
width="628" y="106" x="7"
synchronizationChange="sendMessage(event)" > ...

1 Accepted Solution


Correct answer by
Level 2
Yes, it worked!!! Awesome.

By the way, Adobe 10 fixes my Flex debugger issue..

View solution in original post

5 Replies


Level 10
Hi code_away,

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

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.

hope this helps



Level 2
Hi Nigel,

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



private var _model:SharedCollection ;

private function


_model = new SharedCollection();

_model.sharedID = "_dataSharedModel";

_model.idField = "FirstName";

_model.connectSession = cSession;





private function
modelSynchronizationChange(p_evt:SessionEvent): void {



private function
modelSynchronizationChange1(p_evt:CollectionEvent): void {



private function add():void {




<rtc:ConnectSessionContainer roomURL="myURL"

id="cSession" authenticator="{auth}" height="187"
width="628" y="106" x="7"


Level 2
By the way, I also tried "applicationComplete="add()" to no


Level 10

Doesn't seem like that weird a message - you should install
the latest debug player =).

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

hope that helps



Correct answer by
Level 2
Yes, it worked!!! Awesome.

By the way, Adobe 10 fixes my Flex debugger issue..