actionscript 3 - AS3 | Move graphics points at runtime? -
how graphics points , change values of x&y @ runtime?
for example:
var movetox:array = [50, 200]; var movetoy:array = [0, 0]; var linetox:array = [100, 0, 50, 250, 150, 200]; var linetoy:array = [100, 100, 0, 100, 100, 0]; var _points:array = []; var linesindex:int = 0; var myshape:shape = new shape(); myshape.graphics.linestyle(3, 0x000000, .2); myshape.graphics.beginfill(0x666666, .1); (var i:uint = 0; i< movetox.length; i++) { var _point:point = new point(movetox[i], movetoy[i]); _points.push(_point); } (var p:uint = 0; p< _points.length; p++) { myshape.graphics.moveto(_points[p].x, _points[p].y); myshape.graphics.lineto(linetox[linesindex], linetoy[linesindex]); myshape.graphics.lineto(linetox[linesindex+1], linetoy[linesindex+1]); myshape.graphics.lineto(linetox[linesindex+2], linetoy[linesindex+2]); linesindex +=3; } myshape.x = 0; myshape.y = 0; addchild(myshape);
now want change points values , update shape @ runtime, looking not clear , redraw again.. trying apply changes directly same shape because has lot of points , lines update every 20 milliseconds..
so can please? thnaks.
you can't move graphic geometry , see moves on screen. there no magic , when want see graphic in different position on screen need redraw it. when move movieclip
changing x
or y
properties whole graphics redrawing still. if want translate points same value best way change position properties of shape
object.
Comments
Post a Comment