If you put the circle and the sprites of building in a movieclip and then
rotate the MC, they should stick to the circle, i think.

Or, keep the variable of the angles and then keep increasing the angles of
all the sprites for the same amount. (angle1++, angle2++, angle3++)

Or, since the angle of each is angle of first + n*spacing  (where n is the
number of sprites and spacing the distance - in angles - of each ) you just
have to increase one angle.

OK, i don't think i am very clear. I've had a bad day and my ideas are
confused.


Below is a modified code of a carousel i once created. I think it should
work for you (haven't check after i just made some modifications), but you
could simplify it a lot.



var original_speed:Number=2;// raise or lower to adjust the orbiting speed
var speed:Number=original_speed;
var currentDegrees:Number=0;// don't change
var thumbNum:Number=this.numChildren; //the number of sprites you have to
rotate
var id:Number=0;// don't adjust
var seperation:Number=Math.round(360/thumbNum);// you could hard code a
number here for the amount each thumb is seperated, but this math works
nicely
var circle_radius:Number=thumbNum*50;// radius of the earth

addEventListener(Event.ENTER_FRAME, movingCode);

function movingCode(event:Event):void {

    currentDegrees=currentDegrees+speed;

    while ( id < thumbNum) {

        var radians:Number = (currentDegrees + (seperation * id)) * Math.PI
/ 180;
        var posX:Number=Math.sin(radians)*circle_radius;
        var posY:Number=Math.cos(radians)*circle_radius;

        this["thumb"+id].x=posX;
        this["thumb"+id].y=posY;
        }

        id=id+1;

    }// ends while loop

    if (id==thumbNum) {
        id=0;
    }

}// end function code
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to