Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

Whiteboard Custom Shapes

Avatar

Level 2

I am using the whiteboard custom shapes example. I want to add to the WB toolbar to clear the whiteboard (possiby adding a permission level). Here is the code a I am adding:

var clearShape:WBShapeToolBarDescriptor = new WBShapeToolBarDescriptor(WBShapeToolBarDescriptor.COMMAND);

clearShape.toolTip =

"Clear Whiteboard";

clearShape.command =

"removeAllShapes";

clearShape.icon = CLEAR_IMAGE;

toolBar.addCustomShapeToToolBar(clearShape);

Is there a command to clear the WB? How can I implement this?

Thank you.

6 Replies

Avatar

Employee

hi,

Listen for event WBToolBarEvent.TOOL_BAR_CLICK,

so it should be like

toolBar.addEventListener(WBToolBarEvent.TOOL_BAR_CLICK, clearAllShapes)

protected function clearAllShapes(p_evt:WBToolBarEvent):void

{

          if (p_evt.data.command == "removeAllShapes") {

               sharedWBModel.removeAllShapes();

          }

}

Thanks

Arun

Avatar

Level 2

I keep getting the error:

*1046: Type was not found or was not a compile-time constant:

WBToolBarEvent.*

at:

*protected function clearAllShapes(p_evt:WBToolBarEvent):void

*

Avatar

Employee

Hi,

Can you check the import statement of WBToolBarEvent. I found that the Flex builder for some reason was putting the wrong import statement [import com.adobe.rtc.events WBToolBarEvent;]

The right one is

import com.adobe.coreUI.events.WBToolBarEvent;

Thanks

Arun

Avatar

Level 2

Hi,

Thank you for the fast response. I changed the import and the error is

now in:

protected function clearAllShapes(p_evt:WBToolBarEvent):*void

*

{

if (p_evt.data.command == "removeAllShapes")

{

sharedWB.model.removeAllShapes()

}

}

p_evt.data.command - Undefined property - data.

Thanks,

S

Avatar

Employee

Sorry, it should have been p_evt.item.command, please do let me know if it works.

Thanks

Arun

Avatar

Level 2

Yes, it works fine.

Thank you, Arun.