I’m using AS3.0 and
I’m trying to make a function that will generate a random value between 1-550 (the default width of a flash stage), will animate a movie clip object to move to that point along the x axis, and then make another movie clip object drop from that very point, now thats as far as I got so far (notice the numbers on the right hand side are just there to number the line!!) (“base” is the instance that moves along the X axis, and “ball” is the instance that drops from that point).
function dropBall() {
var randomNum:Number = Math.random() * 550;//The variable "random" equals a random value between 1 to 550
var xAxis:int = Math.round(randomNum); // the variable "xAxis" equals the value of "random", just rounded.
var baseTween:Tween = new Tween(base, x, null, 0, xAxis, 1, true);//Thats the problematic line!!! the value "xAxis" is
//not valid.
ball.x = xAxis; //Makes the ball appear at the random point. here the variable "xAxis" works just fine as a value.
var ballTween:Tween = new Tween(ball, "y", null, 0, 500, 1.2, true); // animates the drop of the ball along the Y axis.
}
Anybody knows why doesn’t the “xAxis” variable works as a value for the new Tween() method on line 4???
Thanks for ANY help 😀
Tween property should be a string.