Need help animating lines using lineTo function

I would like to animate creating a box using using the built in function of movieclip.lineTo() function. I know how to draw the lines but they don’t animate like I want. They just appear went I run the code. I want the top line to draw first from a length of 0 pixels to 200 pixels and same with the sides.

If anyone has clues on how to do this…it would be greatly appreciated.:slight_smile:

What would even be better is a sample code of some sort :slight_smile:

http://proto.layer51.com/d.aspx?f=952

thanks for the link :slight_smile: It’s a great tutorial but what I want to do is instead of drawing a box by myself in the flash program, i want to draw it with

 and have it animatedly draw if that makes sense.  I see a lot of people have boxes coming down/getting bigger and so forth on their site but i want to actually have a box drawn dynmically that is animated too! i.e. a box that just doesn't appear drawn but shows each side lengthing into a box.

I remember seeing a tutorial on this, but I can’t seem to find it. Go to this site http://www.bit-101.com. There are a lot of cool examples here and you can DL the source. Find one that applies and look at the source.

I can make a line grow, but I don’t know enough about API to make a box. For instance - you could do this:


_root.createEmptyMovieClip("holder", 0);
xspeed = 100;
yspeed = 100;
this.onEnterFrame = function () {
this.xspeed += 2;
this.yspeed += 2;
holder.lineStyle(2, 0xFF0000, 100);
holder.moveTo(100, 100);
holder.lineTo(this.xspeed, this.yspeed);
};

So that draws a line across the screen diagonally. I haven’t learned the curveTo thing. Maybe that’ll get you started or give someone else an idea. Good luck!!

did you even go to the link?

[swf=“http://userpages.umbc.edu/~tmccau1/flash/layer51/drawpath.swf height=200 width=300”][/swf]

Sorry Senocular…didn’t look at the tutorial in that way. I thought it was a clever way of creating predetermined paths for movies to follow. I now can see what you are saying…Thanks a lot. Big help!!

Hey Freddythunder…nice footer! Got me to thinking about doing something along those lines on my site :slight_smile:

Thanks again guys for all the help…still a little grasshopper when it comes to flash.

Thanks, I wanted it to repeat forever, but it got a little processor intensive so I had to stop it at like 400 or something, don’t remember…