Need help with a function!

I made actionscript to draw a stack of chips with three different functions.

function blu() {
var chipcount = 0;
for (var j = 0; j<color[1]; j++) {
var h = this.attachMovie(“blue_mc”, (“hole_”+i+"_"+j), chipcount++);
h._y = ay+(j*y_off);
h._x = ax + x_off;
}
}

The functions are for the blue, red, and white chips. However when I tell flash to do the functions, only one column is drawn correctly. Also, any tips on making a tripoley, michigan rummy game, or card game in general would be appreciated.

-Blatex24

hi,

by declaring your chipcount to 0 within the functions (blu, re and white) and using this one as the movie depth, they overwrite each other. Try declaring the chipcount once outside and not in the functions anymore. You’ll see it works

One last question, how would you draw the same stack of chips in the following locations, along with ax,ay?

dx = 10;
dy = 390;
//Defines where the chip piles are located on the right side.
sx = 650;
sy = 200;
fx = 650;
fy = 390;