# There has to be an easier way (Scotty?)

**URL:** <https://forum.kirupa.com/t/there-has-to-be-an-easier-way-scotty/80664>\
**Category:** flash\
**Created:** [February 23, 2005, 8:04pm UTC](https://forum.kirupa.com/t/there-has-to-be-an-easier-way-scotty/80664 "2005-02-23T20:04:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)\
**Post date:** [February 23, 2005, 8:04pm UTC](https://forum.kirupa.com/t/there-has-to-be-an-easier-way-scotty/80664/1 "2005-02-23T20:04:44Z")

</div>

First things first, I suk at for loops and duplicateMovieClip, so I am doing this the hard way. I will have 20 to 30 boxes on the stage that I want to start at one point, then tween in to form a box using the tweenClass using \_x and \_yscale, \_alpha, and \_x and \_y cords.

This is what I have so far but I am starting to think there has to be a better way.

```auto

stop();
alphaMe = Math.random()*100;
function tweenBox1(easeMe) {
	boxTween = new mx.transitions.Tween(box1, "_x", easeMe, box1._x, 300, 50);
	boxTween = new mx.transitions.Tween(box1, "_y", easeMe, box1._y, 300, 50);
	boxTween = new mx.transitions.Tween(box1, "_alpha", easeMe, alphaMe, 100, 50);
	boxTween = new mx.transitions.Tween(box1, "_xscale", easeMe, box1._xscale, 200, 50);
	boxTween = new mx.transitions.Tween(box1, "_yscale", easeMe, box1._yscale, 200, 50);
}
//buttons As
btn1.onRelease = function() {
	tweenBox1(mx.transitions.easing.Strong.easeOut);
}

```

I can always set a var for the end point either in the button or the function, but to do this for 20 to 30 boxes seems retarded. :geek:  
Any ideas? Im lost.  
Josh  
edit: also, when I apply this to two or more boxes, the random.\_alpha occurs for all the boxes, for example, they all start at 56.68 instead of one starting at 20, the other starting at 50 and so on.
