Im messing around with the drawing API and I was wondering how you would go about making it so that the lines are accually drawn on the screen while you watch instead of just being there when you play the movie. I know you can put it the code in different frames so that the lines will appear one by one but I want to accually have it draw it while I watch. Thanks, Digigamer
I’m pretty sure thats not possible…:-\
Put the different points where you want to draw in an array, and then draw onEnterFrame. Let’s say you want to draw a diagonal. The points will be (0,0), then (5, 5) for instance, (10,10) [size=1]I just imgined that the increment is 5, it can be anything you want, really.[/size]
Then we can build the array:
myArray = [] ;
N_POINTS = 50 ; // # of points you want
N_INC = 5 ; // increment
for ( var i = 0; i < N_POINTS; i++ ) {
myArray.push ( { x:i*N_INC, y:i*N_INC } ) ;
}
Then we use an onEnterFrame to get each element of the array and draw to that point:
this.lineStyle ( 0 ) ;
this.moveTo ( myArray[0].x, myArray[0].y ) ;
this.onEnterFrame = function () {
if ( pos < myArray.length ) {
pos++ ;
this.lineTo ( myArray[pos].x, myArray[pos].y ) ;
}
else delete this.onEnterFrame ;
}
pom
Oh, and by the way, in this case, the array is not necessary because the path is very simple, but I used it in case you want to draw something more complex.
and then theres also
http://proto.layer51.com/d.aspx?f=952
Impressive!
oh i read wrong, i thought he meant draw the lines while he was doin the action script on the same screen :-\
thats more or less possible too. (to a degree)
http://www.kirupaforum.com/forums/showthread.php?s=&postid=193101#post193101
alright! thanks Ilyas Masa, thats what I was looking for. And secocular thats cool as well but its way outta my league right now