Expand my Community achievements bar.

Piggybacking...

Avatar

Level 3

Is there an example somewhere of piggybacking a SharedProperty on an existing CollectionNode.

Just for clarity, what I'm trying to do is have multiple SharedProperties use the same CollectionNode. What does the code to do that look like?

Right now I'm doing something like:

---------------------------------------------

var p1:SharedProperty = new SharedProperty();

var p2:SharedProperty = new SharedProperty();

p1.sharedID = foo;

p1.nodeName = 'prop1';

p2.sharedID = foo;

p2.nodeName = 'prop2';

p2.addEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE, onSync);

p1.addEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE, onSync);

p1.subscribe();

p2.subscribe();

---------------------------------------------

These nodes have been created on the server already. But they don't both get synchronized, only one does.

What's the correct way for them to share a CollectionNode?

thanks,

-sandy

2 Replies

Avatar

Former Community Member

Hi,

We do have instances in our code where a collectionNode is used in multiple SharedProperties. See the subscriber function in NoteModel.as class inside com/adobe/rtc/pods/noteClasses/... . We use the same SharedProperty for vertical scrolling as well as text.

Hope this helps.

Thanks

Hironmay Basu

Avatar

Level 3

Awesome! That's exactly what I was looking for.