一個非常完善的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 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM