Dynamic lines

is it possible to dynammically create a line between two moving objects? so the start and end points of the line is attached to two objects?

Yep. You can check the drawing API tute in the AS tricks, and the drawing board tute.

pom :asian:

ah gerat, i’ll look into it…

I’m making sort of a random draw thingy… points a er moving as they were intended, I just thought It’d be fun to makes some lines too! :slight_smile:

I’ll post it when it’s done… just a fun evening project… :slight_smile:

Oki, I can draw the lines now…

but I want it to only draw ONE line per frame… it keeps copying it… I can’t get the clear thing to work properly! It erases the whole thing and nothing shows up…

Oki now I got it to erase… but NOW the line blinks 'cuz of fps…

What do I do?

I want it to present ONE single line, no blinking…

And that line has to be able to move between objects…

It’s impossible (at least for me) to answer your questions if you don’t post the code, Eilsoe. Or the fla. :slight_smile:

here’s my fla:


U can see it keeps making lines… that’s not what i’m after… but since I learned about these lines 20 minutes ago, I think it’s only fair I ask questions about it! :stuck_out_tongue:

Well you can have it as 2 frames.

First frame containing the actions…
_root.createEmptyMovieClip(“test”, 1);
test.lineStyle(1, 0x000000, 100);
test.moveTo(i, i);
test.lineTo(_root._xmouse, _root._ymouse);

and the second frame containing the actions…

This worked for me, but I don’t know if it is exactly what you wanted it to do.

well… with this method, the line also blinks… I set the fps to 30 just to speed things up.

This CAN be used, i mean, i can just set the lineto and moveto, to the xy of my moving objects, but the line still blinks every time the movie changes frame#!

can you follow me…?

well whaddya know…

all of a sudden it stopped blinking… I didn’t even change anything…

scary… :-\

here it is guys!

It worked…! My first experiment with lines! :stuck_out_tongue:

I’m so proud of myself… :slight_smile:

here: lines exp

Nice :slight_smile: But change that background color, please… :stuck_out_tongue:

okeeey, try it again now! :stuck_out_tongue:


Hey, that’s actually very good! Give it a little bit of colour, make it less than 25 lines and I think you can post this at Bit-101 without having to blush, Eilsoe :slight_smile:

pom :asian:

coool! :stuck_out_tongue:

Whaddya mean “less than 25 lines” …? Code? or “lines” directly…?

what colors…? The fills??

Lines of code, yes. And yeah, you could put a fill there, don’t you think?

well there IS a fill! :slight_smile:

tha 50% alpha blue… but yeah, this could get cramped down to less than 25 lines… easily…

then I suspect having to loose the pic in back too… since he states “nothing in the library”…

everything else is pure AS… so… no biggie… :stuck_out_tongue:

??? The one I saw before had no fill, no background… I have to get some sleep.

well ok, but the one above DOES have a fill, and a pic of some greenish little troll thingy… try deleting your temp internet files and check again… otherwise, I’ll post the fla for u, then u can see it! :evil:

I’ll redo the code tomorrow.

I gotta get to bed now… girlfriends calling me! :stuck_out_tongue: