Ever figure out how to do something and have a nagging feeling that you might be doing it the hard way?
I need to determine the pixel location that is 50 pixels to the left of a mc “hslider” on load. I want to be able to reuse the code, or I’d just look and see what it is.
Anyway, I figured out how to do it, but I’m just wondering if there’s a better way.
while (i < Stage.width) {
roundedLoadPosition=Math.round(_root.hslider._x);
findIt=roundedLoadPosition-i;
if(findIt==50) {
foundIt=i;
}
i++
}
Yes, I’m trying to create reusable code. I need to be able to place this movie in any other movie and not need to re-calculate its coordinates everytime. This code works fine for that. Really my root question is this - regardless of that code.
I needed to figure out:
50 = (myMovie._x - n)
I need to place the movie any place and be able to have the ActionScript calculate the value of “n”. Like I said. The code I have works, I’m just wondering if there’s an easier way to find “n” than what I did. I know there’s a lot of Flash math that I’m not familiar with and was wondering if something existed for this.
Well, that’s why I asked. I knew there was something I was overlooking, and I was making it more complicated than it needed to be. Sometimes I get so caught up in solving the ActionScript that the obvious gets blurry.
I may be missing something, Kenny, please ignore me if that’s so. But couldn’t the following code in the slider movie clip do the trick? The code could be reused no matter which movie/movieclip you use it in.