PDA

Click to See Complete Forum and Search --> : dots and lines



dipkya
10-23-2002, 07:48 AM
Hi
Can you tell me how can I make line joins two dots.
wherever I'll click, one dot should appear on screen then if i click second time the second dot will appear with a line connected to these two lines. and so on second will connect to third and third will connect to fourth ..............

bit-101
10-23-2002, 01:07 PM
Originally posted by dipkya
Hi
Can you tell me how can I make line joins two dots.
wherever I'll click, one dot should appear on screen then if i click second time the second dot will appear with a line connected to these two lines. and so on second will connect to third and third will connect to fourth ..............



lineStyle(1,0,100);
onMouseDown=function(){
attachMovie("dot", "d"+i, i++, {_x:_xmouse, _y:_ymouse});
if(drawing){
lineTo(_xmouse, _ymouse);
} else {
moveTo(_xmouse, _ymouse);
}
drawing=!drawing;
}



of course, you have to provide and export the dot movie clip.

dipkya
10-23-2002, 02:45 PM
Hey! cool
Thanx man it works fine..
But its not making a chain kind of........
Is it possible?


Thanx a lot once again:)

bit-101
10-23-2002, 02:48 PM
lineStyle(1,0,100);
onMouseDown=function(){
if(!drawing){
drawing=true;
moveTo(_xmouse, _ymouse);
}
attachMovie("dot", "d"+i, i++, {_x:_xmouse, _y:_ymouse});
lineTo(_xmouse, _ymouse);
}

dipkya
10-24-2002, 01:41 AM
Hey! thats gr8

Thanx a lot...

ericflash
10-26-2002, 01:43 PM
Hey bit two things I am wondering about is
{_x:_xmouse, _y:_ymouse});
is this storing the _x and _y points in a object and how can I trace these to see what is excatly happening in the numbers
Also drawing=!drawing;how does this work
please if you have the time to explain these. Thanks your site by the way is amazing

bit-101
10-28-2002, 04:35 PM
1. that's the initialization object. an optional parameter on attach or duplicate movie. you create an object and assign it some properties there. any properties assigned to that object will be transferred to the movie clip. this creates and object with _x and _y properties, and assigns them the values of the mouse coords at that moment. these get transferred to the newly created clip, so it gets placed at that point.

2. initially drawing is undefined. this will evaluate to false in boolean (true/false) functions. thus,

drawing=!drawing

will result in

drawing = NOT false

or,

drawing = true.

if drawing=true, it will result in drawing=false. it just reverses it.