A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Drawing a circle dynamically?!?

  1. #1
    Senior Member
    Join Date
    May 2001
    Location
    London, England
    Posts
    273

    Drawing a circle dynamically?!?

    Hi guys
    Can anyone help me convert the code below to create a circle using the curveTo() command.
    Would really appreciate it
    Cheers
    Ol

    _root.onMouseDown = function() {
    x0 = _root._xmouse;
    y0 = _root._ymouse;
    draw();
    };
    function draw() {
    _root.onMouseMove = function() {
    x1 = _root._xmouse;
    y1 = _root._ymouse;
    _root.clear();
    _root.lineStyle(1, 0x000000, 100);
    _root.moveTo(x0, y0);
    _root.lineTo(x0, y1);
    _root.lineTo(x1, y1);
    _root.lineTo(x1, y0);
    _root.lineTo(x0, y0);
    };
    }

  2. #2
    professional amateur
    Join Date
    Apr 2001
    Location
    Amsterdam
    Posts
    187
    From flash mx actionscript reference by friends of ED:

    _root.createEmptyMovieClip("circle", 100);
    x = 275; // X-coordinate circle centre
    y = 200; // Y-coordinate circle centre
    R = 100; // Radius of circle
    a = R*0.4086; // Radius multiplied by constant
    b = R*0.7071; // Radius multiplied by constant
    circle.lineStyle(5, 0x000000, 90);
    circle.moveTo(x-R, y);
    circle.curveTo(x-R, y-a, x-b, y-b);
    circle.curveTo(x-a, y-R, x, y-R);
    circle.curveTo(x+a, y-R, x+b, y-b);
    circle.curveTo(x+R, y-a, x+R, y);
    circle.curveTo(x+R, y+a, x+b, y+b);
    circle.curveTo(x+a, y+R, x, y+R);
    circle.curveTo(x-a, y+R, x-b, y+b);
    circle.curveTo(x-R, y+a, x-R, y);
    back to work at flashclub.nl.
    Ngezi


  3. #3
    Developer
    Join Date
    Sep 2001
    Location
    The Bluegrass State Will Flash For Food ™
    Posts
    3,789
    Any idea what the constant is based on?

  4. #4
    Senior Member
    Join Date
    May 2001
    Location
    London, England
    Posts
    273
    I don't even know where to begin!?! Can anyone explain it to me?

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