
MovieClip.lineTo() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
670
|
ActionScript Language Reference
MovieClip.lineTo() Method
draws a straight line at runtime
Flash 6
mc.lineTo(x, y)
Arguments
x The horizontal position of the endpoint of the line to be drawn, as a floating-
point number. Measured relative to
mc’s registration point.
y The vertical position of the endpoint of the line to be drawn, as a floating-
point number. Measured relative to
mc’s registration point.
Description
The lineTo() method draws a straight line from the current drawing pen position to the
point (x,y) (for a description of the drawing pen see MovieClip.moveTo()). The most recent
call to lineStyle() determines the stroke characteristics of the line (thickness, color, and
alpha). If the lineStyle() is
undefined, lineTo() moves the drawing pen position but does not
draw a line on screen (exactly as if moveTo() had been called). The line drawn appears
above all Drawing API content already in
mc, but beneath all other content in mc (e.g., movie
clips, shapes, text, and buttons placed at authoring time, or content attached at runtime via
attachMovie(), duplicateMovieClip(),orcreateTextField()). If either of lineTo()’s arguments
is missing, the operation fails silently.
The following code creates a movie clip named
drawing_mc and draws a 2-point black line
downward ...