Hello,
first of all, I must thank Kirupa for the wonderful greeting:
I’ve never seen anything similar
This is an AS2/Flash8-related question.
I use this code to attach some movieclips:
sPoint = 50;
//
for (i=0; i<10; i++) {
var num = i == 0 ? sPoint : sPoint+ithis[“s”+(i-1)]._width;
_root.attachMovie(“duplicand”, “s”+i, i, {initPos:num, dist:dists});
_root[“s”+i]._x = 50+i*this[“s”+i]._width;
_root[“s”+i]._y = 100;
}
In the initObject I put:
+initPos: it stores informations about the clip _x position;
+dist: follow this post and you will know
I’m duplicating points: these points are subway stations.
In a real world scenario, distances between stations are every time different.
So, I built this array of distances values:
dists = [223,334,12,145,45,87,56,67,78,34];
dists[0] is the distance between the first and the second station and so on.
When I duplicate the clips, there’s no need to show this distance:
the stations must appear at the same distance.
BUT, I made an horizontal slider and what I want is the following:
when i drag the slider left-to-right all the movieclips must proportionally (remember “dist”?) change their positions, proportionally respecting their distances. When I drag the slider right-to-left they must approach, reaching their initial position in the end.
It is not important they scale onEnterFrame: it is right for me this onRelease:
slider.btn.onRelease = slider.btn.onReleaseOutside=function () {
stopDrag();
_global.val = Math.floor(this._x/2);
var cf = Math.floor(val/10);
// ALL MY PROBLEM IN THE END IS THIS LINE:
for (i=0; i<11; i++) {
_root["s"+i]._x = _root["s"+(i-1)].initPos+_root["s"+i].dist*i*cf;
}
};
How can I do what I’m trying to do?
Thanks!