Hello,
I am using Math.random to dynamically change the orbit speed/distance of a movie clip around a point (a second, empty movie clip).
All is well with that.
My issue is that I would like also have another random orbiting movie clip which orbits around it’s own separate point.
The problem is that both instances choose the same value for Math.random.
What can I do so that they both choose different values?
Here is my AS:
var radius = Math.random()*10;
var degrees = Math.random()*1000;
var helper = Math.random(1000);
onEnterFrame = function (){
angle = degrees * (Math.PI/360);
degrees += Math.random()*3;
xposition = radius * Math.cos(angle) *(2.5);
yposition = radius * Math.sin(angle) *(2.2);
government_mc._x = xposition + Math.exp(Math.round(3)) + _root.government_earth._x
government_mc._y = yposition + Math.exp(Math.round(3)) + _root.government_earth._y
teachers_mc._x = xposition + Math.exp(Math.round(3)) + _root.teachers_earth._x
teachers_mc._y = yposition + Math.exp(Math.round(3)) + _root.teachers_earth._y
}
// Import the needed classes:
import mx.transitions.Tween;
import mx.transitions.easing.*;
// Setup the Tween Function
function scaleT(mc, easeType, startSize, endSize, time):Void {
var scaleTween = new Tween(mc, "_xscale", easeType, startSize, endSize, time, true);
var scaleTween = new Tween(mc, "_yscale", easeType, startSize, endSize, time, true);
scaleTween.onMotionFinished = function() {
delete scaleTween;
// trace("scaleTween finished and deleted"); // optional trace call
};
}
//
// Setup the button codes
// yourButton_btn = your button instance
// yourMC = your mc instance you wish to scale
//
government_mc.onRollOver = function():Void {
// scaleT(mc, easeType, startSize, endSize, time) <-- parameters to enter below:
scaleT(government_mc, Strong.easeInOut, 100, 120, 1);
// scales up to specified size on Roll Over
};
government_mc.onRollOut = function():Void {
// scaleT(mc, easeType, startSize, endSize, time) <-- parameters to enter below:
scaleT(government_mc, Strong.easeInOut, 120, 100, 1);
// scales down to orginal size on Roll Out
};
teachers_mc.onRollOver = function():Void {
// scaleT(mc, easeType, startSize, endSize, time) <-- parameters to enter below:
scaleT(teachers_mc, Strong.easeInOut, 100, 120, 1);
// scales up to specified size on Roll Over
};
teachers_mc.onRollOut = function():Void {
// scaleT(mc, easeType, startSize, endSize, time) <-- parameters to enter below:
scaleT(teachers_mc, Strong.easeInOut, 120, 100, 1);
// scales down to orginal size on Roll Out
};
Any help or links would be greatly appreciated.
-Ian