一个非常完善的Flex画板

一个非常完善的画板,还支持通过FMS 多客户端 同步操作,做会议系统、教学系统 非常方便!!

 

http://sitestore.org/demo/LCCS.html 

 支持操作的图形对象应该有这几种:

1.Arrow;

2.Ellipse;

3.HighLightArea;

4.Line;

5.Rectangle;

6.RoundedRectangle;

7.SampleText;

下面相关的操作对象的Demo,有一些朋友有问到怎么转成 FXG, XML,SVG 类似的问题,相信你们也会的,

1.保存图形:就是将上面任意一个对象转成xml而已保存起来,

2.需要显示的话:就将xml里节点对象或者属性取出来,然后new一个图形对象填充好属性Add到容器里,就这么简单。

3.在SDK4.5里有写个一个Demo是将线条保存成 SVG、FXG格式的,和AS3实现的方式有一点不一样,所以自己写了个 http://www.cnblogs.com/dzone/archive/2011/07/18/2109542.html

4.对于LCCS这个东西,个人也只是参考了一下而已,并没真正在开发中使用,只是在4.5里基于Spark自己写过类似的东西,不好在对比性能方面就没试过了,

只是为了适应新的SDK做的开发,如果谁有在Spark中做得的话,希望可以告诉我一下,谢啦!!

 protected function addShapes(p_evt:ContextMenuEvent):void
            {
                if(p_evt.currentTarget.caption == "Add Arrow") {
                    addArrow();
                }
                
                if(p_evt.currentTarget.caption == "Add Ellipse") {
                    addEllipse();
                }
                
                if(p_evt.currentTarget.caption == "Add HighLight Area") {
                    addHighLightArea();
                }
                
                if(p_evt.currentTarget.caption == "Add Line") {
                    addLine();
                }
                
                if(p_evt.currentTarget.caption == "Add Rectangle") {
                    addRectangle();
                }
                
                if(p_evt.currentTarget.caption == "Add Rounded Rectangle") {
                    addRoundedRectangle();                    
                }
                
                if(p_evt.currentTarget.caption == "Add Text") {
                    addSampleText();                    
                }
            }
            
            protected function addShapeClick():void
            {
                if(shapeType.value == "Arrow") {
                    addArrow();
                }
                
                if(shapeType.value == "Ellipse") {
                    addEllipse();
                }
                
                if(shapeType.value == "Highlight Area") {
                    addHighLightArea();
                }
                
                if(shapeType.value == "Line") {
                    addLine();
                }
                
                if(shapeType.value == "Rectangle") {
                    addRectangle();
                }
                
                if(shapeType.value == "Rounded Rectangle") {
                    addRoundedRectangle();                    
                }
                
                if(shapeType.value == "Text") {
                    addSampleText();                    
                }
            }
            
            /**
             * Add an Ellipse using the WBEllipseShapeDescriptor. X, Y and Width and Height are the basic params that need to be specified
             */ 
            protected function addEllipse():void 
            {
                var ellipseDesc:WBEllipseShapeDescriptor = new WBEllipseShapeDescriptor();
                ellipseDesc.x = _lastMouseX; 
                ellipseDesc.y = _lastMouseY;
                ellipseDesc.width = ellipseDesc.height = 100;
                //Add the shapeData to the model. Once the model is updated the shape is added to the canvas.
                sharedWB.model.addShape(ellipseDesc);
            }
            
            /**
             * Add a Rectangle using the WBRectangleShapeDescriptor.
             */ 
            protected function addRectangle():void 
            {
                var rectangleShapeDesc:WBRectangleShapeDescriptor = new WBRectangleShapeDescriptor();
                rectangleShapeDesc.x = _lastMouseX; 
                rectangleShapeDesc.y = _lastMouseY;
                rectangleShapeDesc.width = rectangleShapeDesc.height = 100;
                sharedWB.model.addShape(rectangleShapeDesc);
            }
            
            /**
             * Add a Rounded Rectangle using the WBRoundedRectangleShapeDescriptor.
             */ 
            protected function addRoundedRectangle():void 
            {
                var roundedRectShapeDesc:WBRoundedRectangleShapeDescriptor =  new WBRoundedRectangleShapeDescriptor();
                roundedRectShapeDesc.x = _lastMouseX; 
                roundedRectShapeDesc.y = _lastMouseY;
                roundedRectShapeDesc.width = roundedRectShapeDesc.height = 100;
                sharedWB.model.addShape(roundedRectShapeDesc);
            }

            /**
             * Add a Line using the WBLineShapeDescriptor.
             */             
            protected function addLine():void 
            {
                var lineShapeDesc:WBLineShapeDescriptor = new WBLineShapeDescriptor();
                lineShapeDesc.x = _lastMouseX; 
                lineShapeDesc.y = _lastMouseY;
                lineShapeDesc.width = lineShapeDesc.height = 100;
                sharedWB.model.addShape(lineShapeDesc);
            }
            
            /**
             * Add an Arrow  using the WBArrowShapeDescriptor.
             */             
            protected function addArrow():void 
            {
                var arrowDesc:WBArrowShapeDescriptor = new WBArrowShapeDescriptor();
                arrowDesc.x = _lastMouseX; 
                arrowDesc.y = _lastMouseY;
                arrowDesc.width = arrowDesc.height = 100;
                sharedWB.model.addShape(arrowDesc);
            }
    
            /**
             * Add Text using the WBTextShapeDescriptor.
             */            
            protected function addSampleText():void 
            {
                var textShapeDesc:WBTextShapeDescriptor = new WBTextShapeDescriptor();
                textShapeDesc.x = _lastMouseX; 
                textShapeDesc.y = _lastMouseY;
                textShapeDesc.htmlText = "SampleText";
                sharedWB.model.addShape(textShapeDesc);
            }
            
            /**
             * Add a "Highlight area shape" using the WBHighlightAreaShapeDescriptor.
             * Note a "Highlight area shape" is nothing but a rounded-Rectangle whose alpha is 0.5
             */        
            protected function addHighLightArea():void 
            {
                var hightLightAreaDesc:WBHighlightAreaShapeDescriptor = new WBHighlightAreaShapeDescriptor();
                hightLightAreaDesc.x = _lastMouseX; 
                hightLightAreaDesc.y = _lastMouseY;
                hightLightAreaDesc.width = hightLightAreaDesc.height = 100;
                sharedWB.model.addShape(hightLightAreaDesc);
            }
            
            protected function getShapeClass(p_shapeId:String):String
            {
                var stringFullClass:String = flash.utils.getQualifiedClassName(sharedWB.model.getShapeDescriptor(p_shapeId));
                return stringFullClass.substring(stringFullClass.lastIndexOf("::")+2, stringFullClass.length);
            }

附加Demo, http://pan.baidu.com/s/1kUt5Pcz 

原文地址:https://www.cnblogs.com/dzone/p/2335426.html