I’m trying to place a series of movieclips from my library on a circle ( a slightly tilted circle ).
That said, I have the following code to add the objects but nothing shows up.
I’m probably over-thinking this with this code, anyhow putting traces on each step shows that after the
public function init( ):void {
mainCircle = new circle();
calculate( mainCircle );
addChild( mainCircle );
}
public function calculate( mc:MovieClip ):void {
var centerX:Number = stage.stageHeight / 2;
var centerY:Number = stage.stageWidth / 2;
var maxSpeed:Number = 200;
var zscroll:Number = 0;
var yscroll:Number = 70;
var radius:Number = 300;
var imageScale:Number = 75
var focalLength:Number = 500;
var initialFocal:Number = 500;
trace ( "1 mc x:" + mc.x + " y: " + mc.y );
// Calculate angle
mc.angle += ( 400 - centerX ) / maxSpeed; // 400 can be any number?
mc.angle %= 360;
mc.angle = mc.angle < 0 ? (360) : ( mc.angle );
// Calculate axis
mc.xx = Math.cos( mc.angle*(Math.PI/180))*radius;
mc.zz = centerY-Math.sin( mc.angle*(Math.PI/180))*radius;
mc.yy = yscroll*Math.sin( mc.angle*(Math.PI/180))-50;
trace ( "2 mc x:" + mc.x + " y: " + mc.y );
// Set clip position
var currPos = (initialFocal-zscroll*5) / ( focalLength + mc.zz );
mc.x = mc.xx * currPos + centerX;
mc.y = mc.yy * currPos + centerY;
trace ( "3 mc x:" + mc.x + " y: " + mc.y );
// Set clip scale
mc.scaleX = mc.scaleY = currPos * imageScale - (mc.zz*12/radius);
}
I get the following output from the trace calls - - -
[COLOR=“Blue”]1 mc x:0 y: 0
2 mc x:0 y: 0
3 mc x:-107374182.4 y: -107374182.4[/COLOR]