Expand my Community achievements bar.

LCCS Descriptor Classes - How to use them?

Avatar

Level 2

Hello everyone,

I'm trying to wrap my head around the use of the descriptor classes in the LCCS API.  My goal is to create a shared whiteboard with a custom toolbar, containing mainly custom shape tools, and I want to remove some of the default shape tools.  Looking through the API, I've found some hope in WBToolBarDescriptor, but I'm not very good with AS and I'm unfamiliar with the Descriptor paradigm.  Can anyone point me to some resources? 

Here's what I'm trying to do currently:

//create new descriptor with false indicating no default items

var newToolBarDescriptor:WBToolBarDescriptor = new WBToolBarDescriptor(false);

and then some psuedocode to create the new toolbar

sharedWB.shapesToolBar = createToolBarFromDescriptor(newToolBarDescriptor);

the createToolBarFromDescriptor method does not exist, but I would imagine that there must be some method to take a descriptor and create the described class.  I see there is a uicomponent method createComponentFromDescriptor, but it doesn't seem to take the LCCS descriptors since they are not subclasses of the expected ComponentDescriptor class.

If anyone could lend me a hand it would be much appreciated!  Thanks!

3 Replies

Avatar

Employee

Hi Easterisle,

We have provided a sample app WhiteBoardCustomShapes with the SDK. The app demonstrates how to add custom shapes to the white board.

Steps involved

1) Create your icon for the custom shape

2) Create a Class that would tell the whiteboard  what to draw when the cursor/mouse is dragged around - Refer to WBCustomMarkerShape.as or WBTriangleShape.as or WBFileImageShape.as for reference.

3) Create a Class that would initialize the shape when some one clicks on the toolBar, and simultaneously pop-up the properties toolBar for your custom shape. - Refer to WBCustomMarkerToolBar.as or WBFileImageShapeToolBar.as

4) Finally once you have everything ready you can add your shape to W.Board by modifying the code below.

//Triangle Shape
var triangleShape:WBShapeToolBarDescriptor = new WBShapeToolBarDescriptor(WBShapeToolBarDescriptor.TOOL);
triangleShape.toolTip ="Triangle";
triangleShape.shapeFactory = new WBCustomShapeFactory(WBTriangleShape, WBMarkerShapeFactory.CURSOR_PEN, new WBPropertiesToolBar());
triangleShape.icon = ICON_TRIANGLE;
toolBar.addCustomShapeToToolBar(triangleShape);

Thanks

Arun

Avatar

Level 2

Yeah, I definitely have custom shapes working pretty well, but I'm trying to get a more solid grasp of the API as a whole.  It seems like there are additional classes that I'm not using, such as these descriptor classes, and while my application is running, it still feels hacked together.  I'm more used to lots of docs rather than getting to peer into the source myself coming from the iPhone world  

Avatar

Level 2

Still working on this project, and LCCS looks like such an amazing toolkit, but I wish it had more docs :/  I would love some information on the descriptor paradigm thats being used