Array STUCK! HelP!

I’m Stuck!!! please help me guys…

I want to make an ARRAY for this :

pos1 = mask._x-(0holder.mc1._width);
pos2 = mask._x-(1
holder.mc1._width);
pos3 = mask._x-(2*holder.mc1._width);
b1.onRelease = function() {
holder.slideX(pos1);
};
b2.onRelease = function() {
holder.slideX(pos2);
};
b3.onRelease = function() {
holder.slideX(pos3);
};

but I always got the wrong results, help me please… thank u…

hi
i’m kind of newbie in flash but from what i see in your code i can tell you this:

1st- i don’t see any reference to an array,that is to make an array in flash action script you have to follow this steps

   -declare the array
        myarray=new array(number of items) or array 
        ("item1","item2","item3")
       
    -then you assingn data to your array this way
          myarray[1]=mydata; and so on the [1] is the position within the array where your data will be kept

     -to get your data out from the array you do this

           for example to assign a variable x the value of the 1st element in the array
                   x=myarray[1]

hope i was helpful
bye

Maybe something like this:

pos=new Array();
for (var j=0;j<3;j++){
  pos[j] = mask._x-(j*holder.mc1._width);
}
b1.onRelease = function() {
	holder.slideX(pos[0]);
};
b2.onRelease = function() {
	holder.slideX(pos[1]);
};
b3.onRelease = function() {
	holder.slideX(pos[2]);
};

pom :slight_smile: