dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: distribute mc's in a circle

  1. #1
    Senior Member
    Join Date
    Jul 2002
    Posts
    292

    distribute mc's in a circle

    HI,

    can someone help me distribute mc's in circle. My app is attaching moveiclips for a menu and i can distribute them in a linear sence, but I can't get my head around distributing them in a circle.


    Cheers
    If you feel like your going through hell....just keep on walking

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Location
    Pittsburgh
    Posts
    252
    Hi,

    This might get you started...
    "ball" symbol in library, linkageID = "ball"
    Code:
    function distributeRadial(circCount:Number, radius:Number):Void {
    	var increment:Number = 360/circCount;
    	for (var i = 0; i < circCount; i++) {
    		this.attachMovie("ball", "ball_"+i, i);
    		var ref:MovieClip = this["ball_"+i]
    		var angle = increment * i;
    		var centerX:Number = 275;
    		var centerY:Number = 200;
    		var dX = centerX + Math.cos(angle*(Math.PI/180))*radius;
    		var dY = centerY + Math.sin(angle*(Math.PI/180))*radius;
    		ref._x = dX;
    		ref._y = dY;
    	}
    };
    
    distributeRadial(10, 200);
    hope this helps some,
    Dunc

  3. #3
    Senior Member
    Join Date
    Jul 2002
    Posts
    292
    i have worked out how to place it in a circle

    code:
    curr_item._x = radius*(Math.sin(angle))
    curr_item._y = radius*(Math.cos(angle))



    where radius and angle are set to begin with
    If you feel like your going through hell....just keep on walking

  4. #4
    Senior Member
    Join Date
    Jul 2002
    Posts
    292
    Cheers.

    That is helpful
    If you feel like your going through hell....just keep on walking

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