Closed GoogleCodeExporter closed 8 years ago
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" xmlns:local="*"> <mx:Script> <![CDATA[ import mx.rpc.events.FaultEvent; import mx.utils.ArrayUtil; import mx.collections.ArrayCollection; import mx.rpc.events.ResultEvent; import mx.containers.HBox; import mx.utils.ObjectUtil; import com.roguedevelopment.objecthandles.SelectionManager; import mx.controls.Alert; import com.roguedevelopment.objecthandles.ObjectHandleEvent; import com.zavoo.svg.nodes.SVGRoot; import com.zavoo.svg.SVGViewer; import mx.controls.Image; import com.roguedevelopment.objecthandles.ObjectHandles; import com.zavoo.svg.SvgPaths; import com.zavoo.svg.SvgPath; import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.Event; import flash.display.Graphics; public var paths:SvgPaths; public var canvas:Sprite; [Bindable] private var svgImage:Array = [ {img:"assets/coloredtoucan.svg"}, {img:"assets/eleven_below_single.svg"}, {img:"assets/spring_tree_final.svg"}, {img:"assets/eleven_below_single.svg"}, ]; [Bindable] public var myx:Number = 0; [Bindable] public var galleries:ArrayCollection = new ArrayCollection(); private function httpServicesvg_result(event:ResultEvent):void { var result:ArrayCollection = event.result.galleries.gallery is ArrayCollection ? event.result.galleries.gallery as ArrayCollection : new ArrayCollection(ArrayUtil.toArray(event.result.gallery)); galleries = result; mySvgImage(); } public function mySvgImage():void { Alert.show(ObjectUtil.toString(galleries)); var n:int = galleries.source.length; for (var i:int = 0; i < n; i++) { canvas = new Sprite(); this.rawChildren.addChild(canvas); var loader:URLLoader = new URLLoader(); var request:URLRequest = new URLRequest(galleries.source[i].img); loader.load(request); loader.addEventListener(Event.COMPLETE, onLoadComplete); } } public function init():void { httpServicesvg.url= "assetsXml.xml"; httpServicesvg.send(); httpServicesvg.method="GET"; httpServicesvg.addEventListener(ResultEvent.RESULT, httpServicesvg_result); /*var n:int = svgImage.length; for (var i:int = 0; i < n; i++) { canvas = new Sprite(); this.rawChildren.addChild(canvas); var loader:URLLoader = new URLLoader(); var request:URLRequest = new URLRequest(svgImage[i].img); loader.load(request); loader.addEventListener(Event.COMPLETE, onLoadComplete); } */ } private var index:int = 0; private var localX:int = 10; private var localY:int = 10; private function onLoadComplete(event:Event):void { var loader:URLLoader = URLLoader(event.target); paths = new SvgPaths(loader.data); var svgv:SVGViewer = new SVGViewer(); svgv.xml = new XML(loader.data); svgv.myWidth(50); svgv.myHeight(50); svgv.addEventListener(MouseEvent.CLICK, onVectorGraphicSelect); svgv.x = localX; svgv.y = localY; mygen.addChild(svgv); localX += 60; if(localX >180) { localY += 60; localX = 10; } } private function onVectorGraphicSelect(event:MouseEvent):void { var svgv:SVGViewer = new SVGViewer(); svgv.xml = (event.currentTarget as SVGViewer).xml; svgv.myHeight(150); svgv.myWidth(150); if(svgv != null) { var oh1:ObjectHandles = new ObjectHandles(); oh1.allowHMove=true; oh1.allowHResize=true; oh1.allowVMove=true; oh1.allowVResize=true; oh1.allowRotate=true; oh1.mouseChildren=true; oh1.width=150; oh1.height=150; oh1.addEventListener(ObjectHandleEvent.OBJECT_RESIZED_EVENT,getNewWidthHeight); oh1.addChild(svgv); mygenw.addChild(oh1); } } public var newWidth:Number; public var newHeight:Number; public function getNewWidthHeight(e:ObjectHandleEvent):void{ var svgv:SVGViewer = e.currentTarget.getChildAt(0) as SVGViewer; var seleObject:ObjectHandles= e.currentTarget as ObjectHandles; newWidth = (e.currentTarget as ObjectHandles).width; newHeight = (e.currentTarget as ObjectHandles).height; svgv.myHeight(newHeight); svgv.myWidth(newWidth); } private function httpService_fault(evt:FaultEvent):void { var title:String = evt.type + " (" + evt.fault.faultCode + ")"; var text:String = evt.fault.faultString; //alert = Alert.show(text, title); // xmlListColl.removeAll(); } ]]> </mx:Script> <mx:HTTPService id="httpServicesvg" resultFormat="e4x" fault="httpService_fault(event);"/> <mx:Canvas id="mygen" width="100%" height="100%"> </mx:Canvas> <mx:Canvas id="mygenw" width="50%" height="50%" y="200" borderStyle="solid" borderColor="#ff00ff"/> </mx:Application>
Original issue reported on code.google.com by abidr...@gmail.com on 30 Sep 2009 at 4:59
abidr...@gmail.com
Attachments:
I'm unsure of what this issue is about.
Original comment by marc.hug...@gmail.com on 22 Dec 2009 at 3:44
marc.hug...@gmail.com
Original issue reported on code.google.com by
abidr...@gmail.com
on 30 Sep 2009 at 4:59Attachments: