一个简单的Flex画图

xiaoxiao2024-12-21  11

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" borderColor="#FFFFFF" mouseMove="onMouseMove()" mouseUp="onMouseUp()" mouseDown="onMouseDown()"> <mx:Script> <![CDATA[ import mx.effects.Move; import mx.controls.*; import mx.core.*; import mx.effects.*; public var lines :Sprite = new Sprite (); public var lines1 :flash.display.Sprite = new Sprite (); private var lineX:int; private var lineY:int; private var bool:Boolean=false; // public function TestPaint():void // { // //Alert.show("Hello World!"); // lines.graphics.lineStyle(2,0x0099ff,1); // lines.graphics.moveTo(0,0); // lines.graphics.lineTo(50,50); // var comp: UIComponent = new UIComponent(); // comp.addChild(lines); // addChild(comp); // } public function onMouseDown():void { lineX=this.mouseX; lineY=this.mouseY; lines.graphics.lineStyle(2,0x0099ff,1); lines.graphics.moveTo(lineX,lineY); bool=true; } public function onMouseMove():void { if(bool) { lines.graphics.lineTo(this.mouseX,this.mouseY); } } public function onMouseUp():void { var comp: UIComponent = new UIComponent(); comp.addChild(lines); addChild(comp); bool=false; } ]]> </mx:Script> </mx:Application> 相关资源:用as3弄的一个简单的画图板代码不多送给新手学习
转载请注明原文地址: https://www.6miu.com/read-5021653.html

最新回复(0)