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

SOLVED

SharedModel, shared property error

Avatar

Level 3

My sharedproperty works fine, however, I alwasy get this exception when I start my program.

I basically extended a button and turned into a "SharedButton"

Error: Could not find the requested node.
    at com.adobe.rtc.sharedModel::CollectionNode/getNodeConfiguration()[D:\Program Files\Adobe\Flex Builder 3.1\plugins\com.adobe.afcs\libs\player9\src\com\adobe\rtc\sharedModel\CollectionNode.as:394]
    at com.adobe.rtc.sharedModel::SharedProperty/commitProperties()[D:\Program Files\Adobe\Flex Builder 3.1\plugins\com.adobe.afcs\libs\player9\src\com\adobe\rtc\sharedModel\SharedProperty.as:615]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.adobe.rtc.util::Invalidator/onInvalidationComplete()[D:\Program Files\Adobe\Flex Builder 3.1\plugins\com.adobe.afcs\libs\player9\src\com\adobe\rtc\util\Invalidator.as:61]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.utils::Timer/tick()

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi ,

I found the problem :). So, basically when you do _sharedButton.publishModel in your code, the model is not synchronized by then and the node is not created the first time. This error is only used to happen when you will run the app the first time in a room. So, on your side, you need to wait till the SharedProperty is synchronized to be on safe side, and our side I will fix it so that it doesn’t throw the exception even the first time.

I am attaching your code modified with the changes. Thanks for reporting.

Hope this helps.

Regards

Hironmay Basu

// ActionScript file

package

{

import com.adobe.rtc.events.CollectionNodeEvent;

import com.adobe.rtc.events.SharedPropertyEvent;

import com.adobe.rtc.messaging.UserRoles;

import com.adobe.rtc.sharedModel.SharedProperty;

import flash.events.MouseEvent;

import mx.controls.Button;

public class SharedButton extends Button

{

public function SharedButton()

{

super();

}

protected var _sharedButton:SharedProperty;

override protected function createChildren():void

{

super.createChildren();

toggle = true;

_sharedButton = new SharedProperty();

_sharedButton.sharedID = id;

_sharedButton.subscribe();

sharedButton.addEventListener(CollectionNodeEvent.SYNCHRONIZATIONCHANGE,onSyncChange);

addEventListener(MouseEvent.CLICK, onLocalClick);

_sharedButton.addEventListener(SharedPropertyEvent.CHANGE, onRemoteClick);

}

protected function onSyncChange(p_evt:CollectionNodeEvent):void

{

if ( _sharedButton.isSynchronized ) {

_sharedButton.publishModel = UserRoles.PUBLISHER ;

}

}

protected function onLocalClick(p_evt:MouseEvent):void

{

_sharedButton.value = selected;

}

protected function onRemoteClick(s_evt:SharedPropertyEvent):void

{

selected = _sharedButton.value;

}

}

}

View solution in original post

0 Replies

Avatar

Level 10

Just from exception, it is hard to tell why you are getting the exception. Can you attach an example with your sharedbutton code that reproduces this ?

Thanks

Hironmay Basu

Avatar

Level 3

This is a copy of SharedButton.as

Thank you.

package
{
    import com.adobe.rtc.events.SharedPropertyEvent;
    import com.adobe.rtc.messaging.UserRoles;
    import com.adobe.rtc.sharedModel.SharedProperty;
   
    import flash.events.MouseEvent;
   
    import mx.controls.Button;

    public class SharedButton extends Button
    {
        public function SharedButton()
        {
            super();
        }
       
        protected var _sharedButton:SharedProperty;
       
        override protected function createChildren():void
        {
            super.createChildren();
            toggle = true;
            _sharedButton = new SharedProperty();           
            _sharedButton.publishModel = UserRoles.PUBLISHER;
            _sharedButton.sharedID = id;

            _sharedButton.subscribe();
            addEventListener(MouseEvent.CLICK, onLocalClick);
            _sharedButton.addEventListener(SharedPropertyEvent.CHANGE, onRemoteClick);
        }
       
        protected function onLocalClick(p_evt:MouseEvent):void
        {           
            _sharedButton.value = selected;
        }
       
        protected function onRemoteClick(s_evt:SharedPropertyEvent):void
        {
            selected = _sharedButton.value;
        }
               
    }
}

I then instantiate it like this...

<l:SharedButton id="_mybutton" label="My shared button" />

Thanks again for your help

Avatar

Correct answer by
Level 10

Hi ,

I found the problem :). So, basically when you do _sharedButton.publishModel in your code, the model is not synchronized by then and the node is not created the first time. This error is only used to happen when you will run the app the first time in a room. So, on your side, you need to wait till the SharedProperty is synchronized to be on safe side, and our side I will fix it so that it doesn’t throw the exception even the first time.

I am attaching your code modified with the changes. Thanks for reporting.

Hope this helps.

Regards

Hironmay Basu

// ActionScript file

package

{

import com.adobe.rtc.events.CollectionNodeEvent;

import com.adobe.rtc.events.SharedPropertyEvent;

import com.adobe.rtc.messaging.UserRoles;

import com.adobe.rtc.sharedModel.SharedProperty;

import flash.events.MouseEvent;

import mx.controls.Button;

public class SharedButton extends Button

{

public function SharedButton()

{

super();

}

protected var _sharedButton:SharedProperty;

override protected function createChildren():void

{

super.createChildren();

toggle = true;

_sharedButton = new SharedProperty();

_sharedButton.sharedID = id;

_sharedButton.subscribe();

sharedButton.addEventListener(CollectionNodeEvent.SYNCHRONIZATIONCHANGE,onSyncChange);

addEventListener(MouseEvent.CLICK, onLocalClick);

_sharedButton.addEventListener(SharedPropertyEvent.CHANGE, onRemoteClick);

}

protected function onSyncChange(p_evt:CollectionNodeEvent):void

{

if ( _sharedButton.isSynchronized ) {

_sharedButton.publishModel = UserRoles.PUBLISHER ;

}

}

protected function onLocalClick(p_evt:MouseEvent):void

{

_sharedButton.value = selected;

}

protected function onRemoteClick(s_evt:SharedPropertyEvent):void

{

selected = _sharedButton.value;

}

}

}

Avatar

Level 3

Thanks for the wonderful effort and the quick responses... Have a good day.