5 Replies Latest reply on Nov 15, 2006 8:44 AM by exPluda?

# How do I define the greatest _x position based on a loop, assuming I know the last element of the loop?

Hello,

This may be complicated,

I've a loop that creates emptyMovieClips
then I use one function to onRollOver _xscale them += 10

Now I want to move another movieClip based on the greatest _x position of my previously _xscaled elements, how do I do that?

example

for (var i = 0; i<my_array.length; i++) {
}
//
this._xscale += 10;
//
MY_DRAGER._x = HIGHT._x;
}

Can this be done?

Thanks,
• ###### 1. Re: How do I define the greatest _x position based on a loop, assuming I know the last element of the loop?
Anyone please, I'm really lost here :-)
• ###### 2. Re: How do I define the greatest _x position based on a loop, assuming I know the last element of the loop?
hi pluda,

so you can use for greatest _root.menu_._width

if this is not you are looking for... please be little clear... so we can get clear picture...
:-)
• ###### 3. Re: How do I define the greatest _x position based on a loop, assuming I know the last element of the loop?

well, that doesn't work as expected, since my drager_x is always incrementing and that is not what I need

lets say you have 3 buttons (movieclips) inside menu_ (movieClip)

1
2
3

each of them as an rollOver function

this._xscale += 10;
}

now, if I rollOver twice button 2 per example is _x will be 20
if I rollOver button 1 once, is _x will be 10, but the higuest _x remains button 2 _x

What I need is to be able to know what button has the higuest _x, so I can put my drager in the right place

Thanks
• ###### 4. Re: How do I define the greatest _x position based on a loop, assuming I know the last element of the loop?
hi pluda,

i've set up a sample: The SWF
of what i think you're after.
The code's a bit complex, i'm sure it could be simplified.

• ###### 5. Re: How do I define the greatest _x position based on a loop, assuming I know the last element of the loop?
Hello,

that's exacly what I need, thanks a ton for your example, I'm going to stydy your code now.

Pluda