Expand my Community achievements bar.

WBModel.addShape Error

Avatar

Level 4

Hey everyone, me again!

I am creating a SharedWhiteBoard thus:

_whiteBoard = new SharedWhiteBoard();
_whiteBoard.connectSession = _afcsSessionProxy.connectSession;
_whiteBoard.width =
    _whiteBoard.height =
    MetricsConstants.WHITEBOARD_DEFAULT_SIZE;
_whiteBoard.setStyle("backgroundAlpha", 0);
_whiteBoard.addEventListener(FlexEvent.CREATION_COMPLETE, _onWhiteBoardCreationComplete);
_whiteBoard.addEventListener(WBCanvasEvent.PROPERTIES_TOOLBAR_ADD, _onWhiteBoardPropertiesToolBarAdded);
_whiteBoard.addEventListener(WBCanvasEvent.PROPERTIES_TOOLBAR_REMOVE, _onRemovePropertiesToolBarFromWhiteBoard);
_whiteBoard.addEventListener(MouseEvent.MOUSE_WHEEL, _onMouseWheelRolled);

a little after this I am trying to add a shape thus:

_whiteBoard.width = 800;
_whiteBoard.height = 450;

var shape:WBShapeDescriptor = new WBShapeDescriptor();
shape.width = shape.height = 1;
_whiteBoard.model.addShape(shape);

but sadly getting this error:


TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at com.adobe.coreUI.controls.whiteboardClasses::WBCanvas/onShapeAdd()[C:\work\main\connect\cocomoPlayer10\src\com\adobe\coreUI\controls\whiteboardClasses\WBCanvas.as:1027]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.adobe.rtc.pods.sharedWhiteBoardClasses::SharedWBModel/onShapeAdd()[C:\work\main\connect\cocomoPlayer10\src\com\adobe\rtc\pods\sharedWhiteBoardClasses\SharedWBModel.as:479]
    at com.adobe.rtc.pods.sharedWhiteBoardClasses::SharedWBModel/onItemReceive()[C:\work\main\connect\cocomoPlayer10\src\com\adobe\rtc\pods\sharedWhiteBoardClasses\SharedWBModel.as:640]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.adobe.rtc.sharedModel::CollectionNode/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItem()[C:\work\main\connect\cocomoPlayer10\src\com\adobe\rtc\sharedModel\CollectionNode.as:742]
    at com.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItem()[C:\work\main\connect\cocomoPlayer10\src\com\adobe\rtc\messaging\manager\MessageManager.as:663]
    at com.adobe.rtc.session.managers::SessionManagerBase/receiveItem()[C:\work\main\connect\cocomoPlayer10\src\com\adobe\rtc\session\managers\SessionManagerBase.as:331]

what am i doing wrong here?

would dig down into WBCanvas, but only have a swc.

1 Reply

Avatar

Employee

Hi Dubya,

The shape var(ShapeDescriptor) in your code lacks factoryId. Thats why you see a null error. Also when you are trying to add a custom shape, you must register the shape's factory with the SharedWhiteBoard.

Also the other good news is that player 10 src is on its way. If you are still curious as to why you are still facing the issue, check out the onShapeAdd method in WBCanvas.as in player 9 src.

Thanks

Arun