hi, i have a problem to draw lines to form a box (animated). Thanks.
What do you mean?
With the MX drawing API? Or by hand?
Please be more specific in what you are trying to do.
But I will post this anyway, there is a drawing API tutorial on this site…
http://www.kirupa.com/developer/actionscript/as_tricks.asp
Guess what link it is under in there…lol.
That’s great and all, but is there a way to have a line be drawn, not ahead of time, but watch it be drawn?
I am messing around with it, and not really being too fluent in AS, I am having a heck of a time.
I completely understand that tutorial, along with the one where you can create a ‘drawing board’. I am not interested in that, but how about where you hit a button, the AS picks 2 random points, and then ANIMATES it being drawn. Is there a way to do that?
Oh yes… I have looked already and searched the archives for this, but have not found a clear answer. Please help!
Something like this?
point1={x:100,y:100};
point2={x:400,y:400};
diffx=point2.x-point1.x;
diffy=point2.y-point1.y;
steps=100;
currentPoint=point1;
this.lineStyle(0,0,100);
this.moveTo(currentPoint.x,currentPoint.y);
i=1;
this.onEnterFrame=function(){
if (i<=steps){
currentPoint.x+=diffx/steps;
currentPoint.y+=diffy/steps;
this.lineTo(currentPoint.x,currentPoint.y);
i++;
} else delete this.onEnterFrame;
}
pom :moustache
Exactly!
Now how to make that line, kinda trace itself back up… like it draws itself, and then the beginning of the line retracts itself to the end of the newly drawn line.
I am trying to get the code for how that site was done with random lines drawn … it’s 5:13 am here in AZ, and I haven’t slept yet … please excuse the incoherent nature!
Thanks
bump
I dont quite understand what youre trying to do but have you tried achieving this with shape tweening?? this is how i do it and it works great and file size isnt huge hope this helps
Grim
Check out the lines experiments from David Hirmes. Is that wat you want?
Yes … kiiiiiiiiiiinda. I’m lookin for something … KIND OF like lines #10. Actually a little bit from lines #6 as well. What I want it to do, is select an ending point. You have the starting point, and then an ending point. On release of a button, it creates a RANDOM path to get from point A to point B. Whether it goes straight, then curves, and then a jagged right turn to its ending point, it doesn’t matter. As long as when I click on a button, it goes from the decided point A (starting), to the starting point B (ending) and a random path is created for it being drawn.
The part I ‘kinda’ wanna steal from lines #6 is how the alpha of it (or darkness whatever) is light and then goes dark. What I want is, that once the line has been drawn, i want it to retrace itself… kinda back into itself , or heck the alpha of it goes from 100 to Zero. So that it is drawn, then sucks itself back in, or fades once the path is complete. I’ll post an FLA here of a basic hand drawn, ROUGH example of a MC of what I want to do randomly with AS.
bump
i can’t make the ■■■■ line white… grrr…
i have
this.lineStyle(1,0x000000,100);
grrr…
edit: duh… that’d be black anyways, but i’ve been messing wit it some more and i still can’t get it white… =/
yet another edit: ok i got it to be white now… but it wont go in front of a background i made… even tho i have the layer with the actionscript on top.
hmm got a question concerning ilyas’s script.
How come if i have an empty keyframe at frame 1 w/ the script in it… and say i put another one at frame 20 with the same script, once it hits frame 20 it stops making the first line and starts on the second??
I’ve been looking through the script and i can’t figure out how to get it to not do that.