A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: dots and lines

  1. #1
    Senior Member dipkya's Avatar
    Join Date
    Mar 2001
    Location
    Mumbai (India)
    Posts
    158

    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!

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Posts
    368

    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.

  3. #3
    Senior Member dipkya's Avatar
    Join Date
    Mar 2001
    Location
    Mumbai (India)
    Posts
    158
    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!

  4. #4
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    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);
    }

  5. #5
    Senior Member dipkya's Avatar
    Join Date
    Mar 2001
    Location
    Mumbai (India)
    Posts
    158
    Hey! thats gr8

    Thanx a lot...
    dipkya
    ---------------------------------------------------------------
    SO MUCH HAVE TO DO, SO LITTLE HAS DONE!

  6. #6
    Senior Member
    Join Date
    Apr 2001
    Posts
    996
    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

  7. #7
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center