Closed GoogleCodeExporter closed 9 years ago
package com.roguedevelopment.flowchart { import com.roguedevelopment.objecthandles.ObjectHandleEvent; import com.roguedevelopment.objecthandles.ObjectHandles; import com.roguedevelopment.objecthandles.SelectionManager; import flash.events.Event; import flash.geom.Point; import mx.containers.Canvas; import mx.controls.Alert; import mx.core.ClassFactory; public class ObjectSource { protected var _factory:ClassFactory; protected var _position:Point; protected var _parent:Canvas; public var selectedObjectNew:ObjectHandles=null; public function ObjectSource(factory:ClassFactory, parent:Canvas, position:Point) { _factory = factory; _position = position; _parent = parent; createObject(); } protected function createObject() : void { var obj:ObjectHandles = _factory.newInstance() as ObjectHandles; obj.removeEventListener(ObjectHandleEvent.OBJECT_MOVING_EVENT, onMoved ); obj.addEventListener(ObjectHandleEvent.OBJECT_SELECTED,OnObjectHandlesSelected1) ; obj.x = _position.x; obj.y = _position.y; SelectionManager.instance.addSelectable(obj); _parent.addChild( obj ); } protected function onMoved(event:Event) : void { var obj:ObjectHandles = event.target as ObjectHandles; obj.removeEventListener(ObjectHandleEvent.OBJECT_MOVING_EVENT, onMoved ); //createObject(); } private function OnObjectHandlesSelected1(event:ObjectHandleEvent):void { var obj:ObjectHandles = event.currentTarget as ObjectHandles; if(obj != null) { selectedObjectNew = obj; //Alert.show("hi"+selectedObjectNew); } } } } private function Delete():void { if(selectedObject != null) { selectedObject.removeAllChildren(); }else if(myObjSource.selectedObjectNew !=null) { Alert.show("hi"+myObjSource.selectedObjectNew); //myObjSource.selectedObjectNew.parent.removeChild(myObjSource.selectedObjectNew ); } /* else if(selectedShape != null) { selectedShape.parent.removeChild(selectedShape); } */ if(cnvsParent.parent!= null) cnvsParent.parent.removeChild(cnvsParent); } [Bindable] private var myObjSource:ObjectSource; public function drawShape(id:String):void { var shape:String=id; //var myObjShp:ObjectHandlesCanvas = new ObjectHandlesCanvas(); //var myObjShpNew:ObjectHandles = new ObjectHandles(); //myObjShp.setStyle("borderStyle","none"); var myObjShp:Canvas = new Canvas(); if(shape=="circle") { myObjSource = new ObjectSource( new ClassFactory( com.roguedevelopment.flowchart.shapes.CircleShape), myObjShp, new Point(300,50) ); generic.addChild(myObjShp); /* myObjShp.addEventListener(MouseEvent.CLICK, function click(e:MouseEvent):void { var obj:ObjectHandlesCanvas = e.currentTarget as ObjectHandlesCanvas; if(obj != null) { selectedShape = obj; selectedObject = null; } }); */ } else if(shape=="rectangle") { myObjSource = new ObjectSource( new ClassFactory( com.roguedevelopment.flowchart.shapes.SquareShape), myObjShp, new Point(300,50) ); generic.addChild(myObjShp); /* myObjShp.addEventListener(MouseEvent.CLICK, function click(e:MouseEvent):void { var obj:ObjectHandlesCanvas = e.currentTarget as ObjectHandlesCanvas; if(obj != null) { selectedShape = obj; selectedObject = null; } }); */ } }
Original issue reported on code.google.com by abidr...@gmail.com on 12 Aug 2009 at 8:15
abidr...@gmail.com
I'm unsure what this issue is about.
Original comment by marc.hug...@gmail.com on 22 Dec 2009 at 3:50
marc.hug...@gmail.com
Original issue reported on code.google.com by
abidr...@gmail.com
on 12 Aug 2009 at 8:15