03Mar
[AS 3] Drawing Dynamic Line Curves with curveTo Method
No commentsDemonstration of the curveTo method. Simply roll your mouse over the movie below.
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
public class CurveToExample extends Sprite
{
public function CurveToExample()
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, drawCurve);
}
private function drawCurve(m:MouseEvent):void
{
// clear the board on each Mouse Move
graphics.clear();
// draw the line
graphics.lineStyle(1);
graphics.moveTo(0,stage.stageHeight / 2);
graphics.curveTo(mouseX,mouseY,stage.stageWidth,stage.stageHeight / 2);
}
}
}
Categories: Actionscript 3, Drawing API
Monday, March 3rd, 2008 at 11:13 am and is filed under Actionscript 3, Drawing API. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.