-
Senior Member
dots and lines
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 ..............
dipkya
---------------------------------------------------------------
SO MUCH HAVE TO DO, SO LITTLE HAS DONE!
-
Re: dots and lines
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 ..............
Code:
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.
-
Senior Member
Hey! cool
Thanx man it works fine..
But its not making a chain kind of........
Is it possible?
Thanx a lot once again
dipkya
---------------------------------------------------------------
SO MUCH HAVE TO DO, SO LITTLE HAS DONE!
-
Code:
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);
}
-
Senior Member
Hey! thats gr8
Thanx a lot...
dipkya
---------------------------------------------------------------
SO MUCH HAVE TO DO, SO LITTLE HAS DONE!
-
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
-
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|