<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" xmlns:paper="com.acj.containers.*" width="600" height="450" backgroundColor="#FFFFFF" borderColor="#FFFFFF" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ import com.acj.paperClasses.RectangleTool; import com.acj.paperClasses.LineTool; import com.acj.paperClasses.DrawingTool; private var selectedTool:DrawingTool; /** * please note the code in this mxml file i'm not proud of... the whole * lineToolClicked and rectangleToolClicked is too static * but the point of this example is to show how to draw, not create * a buttonToggle thingy mo bob... so to delay putting this out there... * this is just a quicky interface... **/ private function lineToolClicked(event:Event):void{ btnRectangleTool.selected = !btnLineTool.selected; blankPaperWrapper.selectedTool = com.acj.paperClasses.LineTool; } private function rectangleToolClicked(event:Event):void{ btnLineTool.selected = !btnRectangleTool.selected; blankPaperWrapper.selectedTool = com.acj.paperClasses.RectangleTool; } ]]> </mx:Script> <paper:BlankPaperWrapper id="blankPaperWrapper" width="100%" height="100%" /> <mx:HBox width="100" x="611" y="10"> <mx:Button id="btnLineTool" icon="@Embed('assets/LineTool.png')" click="lineToolClicked(event)" toggle="true"/> <mx:Button id="btnRectangleTool" icon="@Embed('assets/RectangleTool.png')" click="rectangleToolClicked(event)" toggle="true"/> </mx:HBox> <mx:Text x="611" y="58" text="click a tool and start drawing by draggin your mouse on the white, the class isn't finished yet, but it's just an example... please dont be too harsh to judge" width="157" height="154"/> </mx:Application>