• AS3 Tween
    3 replies, posted
I have these two lines of code [code]var yTween:Tween = new Tween (greenBox1, "y", None.easeNone, greenBox1.y, endPointY, Math.Floor((Math.random() * 5)), true); var xTween:Tween = new Tween (greenBox1, "x", None.easeNone, greenBox1.x, endPointX, Need Time Here, true);[/code] is there anyway to get the time from the yTween, (Math.Floor(Math.random() * 5)) into the xTween ?? cant find how to thanks
you can create a variable right before you call the tweens and apply that to both of the tweens [CODE] var rand:Number = Math.Floor((Math.random() *5)); var yTween:Tween = new Tween (greenBox1, "y", None.easeNone, greenBox1.y, endPointY, rand, true); var xTween:Tween = new Tween (greenBox1, "x", None.easeNone, greenBox1.x, endPointX, rand, true);[/CODE]
ah yeah thanks my mind was totally blank xD i always try to over complicate
you should also check out [URL="http://code.google.com/p/tweener/"]Tweener[/URL] instead of using the built in Tween class, I find it much simpler and it is supposedly more efficient.
Sorry, you need to Log In to post a reply to this thread.