# Need help with a function!

**URL:** <https://forum.kirupa.com/t/need-help-with-a-function/115064>\
**Category:** Uncategorized\
**Created:** [July 5, 2004, 2:53pm UTC](https://forum.kirupa.com/t/need-help-with-a-function/115064 "2004-07-05T14:53:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blatex24](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@blatex24](https://forum.kirupa.com/u/blatex24)\
**Post date:** [July 5, 2004, 2:53pm UTC](https://forum.kirupa.com/t/need-help-with-a-function/115064/1 "2004-07-05T14:53:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 5, 2004, 3:31pm UTC](https://forum.kirupa.com/t/need-help-with-a-function/115064/2 "2004-07-05T15:31:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 5, 2004, 4:57pm UTC](https://forum.kirupa.com/t/need-help-with-a-function/115064/3 "2004-07-05T16:57:58Z")

</div>

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;
