![]() |
![]() |
||||||
|
|||||||
| Tags: |
![]() |
|
|||
|
Im try to draw a simple line with line to funtion here is my code
private function draw(sprite:Sprite):void { sprite.graphics.lineStyle(1, 1, 1); sprite.graphics.beginFill(bgColor); sprite.graphics.moveTo(0, 0); sprite.graphics.lineTo(9000000,9000000); sprite.graphics.endFill(); } but line thikness become unexpectedly wide. is it flex bug. this is also ture as curveTo. here is my detail code advance thanks for any feed back. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="draw()"> <mx:Script> <![CDATA[ // Draw an arrow. public function draw(){ var x:LineTool=new LineTool(); this.addChild(x); } ]]> </mx:Script> </mx:Application> package { import flash.display.Sprite; import flash.events.MouseEvent; import mx.core.UIComponent; public class LineTool extends UIComponent { private var size:uint = 100; private var bgColor:uint = 0xFFCC00; public function LineTool() { var child:Sprite = new Sprite(); child.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); child.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); draw(child); addChild(child); } private function mouseDownHandler(event:MouseEvent):void { trace("mouseDownHandler"); var sprite:Sprite = Sprite(event.target); sprite.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); sprite.startDrag(); } private function mouseUpHandler(event:MouseEvent):void { trace("mouseUpHandler"); var sprite:Sprite = Sprite(event.target); sprite.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); sprite.stopDrag(); } private function mouseMoveHandler(event:MouseEvent):void { trace("mouseMoveHandler"); event.updateAfterEvent(); } private function draw(sprite:Sprite):void { sprite.graphics.lineStyle(1, 1, 1); sprite.graphics.beginFill(bgColor); sprite.graphics.moveTo(0, 0); sprite.graphics.lineTo(9000000,9000000); // sprite.graphics.curveTo(0,0,199991,0); sprite.graphics.endFill(); } } } |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise