# How to create a column header in a grid using action script?

**URL:** <https://forum.kirupa.com/t/how-to-create-a-column-header-in-a-grid-using-action-script/206021>\
**Category:** flash\
**Created:** [November 4, 2006, 5:03am UTC](https://forum.kirupa.com/t/how-to-create-a-column-header-in-a-grid-using-action-script/206021 "2006-11-04T05:03:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lavanya](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@Lavanya](https://forum.kirupa.com/u/Lavanya)\
**Post date:** [November 4, 2006, 5:03am UTC](https://forum.kirupa.com/t/how-to-create-a-column-header-in-a-grid-using-action-script/206021/1 "2006-11-04T05:03:06Z")

</div>

Hi all,

I have tried to draw a grid like thing in flash using action script with the help of looping, how can i change the color of the first row in the grid? plz help me in coding. I have shared the coding here… this will create a table like structure with 5 rows and columns with some random numbers inside each cell.

for (var i = 1; i\<=5; i++) {  
for (var j = 1; j\<=5; j++) {  
counter++;  
// We attach the movie clip on the stage  
grid\_container.attachMovie(“cellMCs”, “cell”+counter, counter);

// We assign a \_x position to the cell  
grid\_container[“cell”+counter].\_x = initX;

// We assign a \_y position to the cell  
grid\_container[“cell”+counter].\_y = initY;

grid\_container[“cell”+counter].randomNumber.setNewTextFormat(txtFormat);  
// We generate a random number that we display in the dynamic text field of the cell  
grid\_container[“cell”+counter].randomNumber.text = Math.floor(Math.random()\*9)+1;  
trace(grid\_container[“cell”+counter].randomNumber.text);  
// We assign a onRelease event to the cell  
//grid\_container[“cell”+counter].onRelease = function() {  
[//cellName.text](https://cellName.text) = this.\_name;  
//};  
initX += 30;  
}  
initY += 30;  
initX = 0;  
}

Thanks in advance,  
Cbe.
