Global array problem - whole line sets instead of single cell

I’m using the following script on a button/movie clip to control the placement and rotation of an object. Half way down the code i have detailed the problem that i am encountering. I don’t know if my syntax for access to a global array is correct but this line is definately where the problem lies.

on (press)
{
_global.cogrot[1];
_global.cogarray = new Array(5,6);
_global.matflag = new Array(1);
}

on (releaseOutside)
{
var madvar=1000;
var num1;
var num2;
overpeg=0;
//stopDrag();
for (num1=1; num1<=4; num1++)
{ for (num2=1; num2<=5; num2++)
{ if (this._x>((73.5num1)+105.3))
{ if (this._x<((73.5
num1)+105.3+16))
{ if (this._y>((73.5num2)+20.2))
{ if (this._y<((73.5
num2)+20.2+16))
{ this._x=(num173.5)+105.3+8;
this._y=(num2
73.5)+20.2+8;
trace(1000000);
for (num3=0; num3<=5; num3++)
{ for (num4=0; num4<=6; num4++)
{ trace(_global.cogarray[num3,num4]);
}
}
trace(1000000);

[color=red]This line is causing the problem…[/color]

[color=blue]---------------------------------> _global.cogarray[num1,num2]=1; [/color]

[color=red]Gives an output in the array which looks like…[/color]

//0 0 0 0 0 0…0 0 0 0 0 0
//1 1 1 1 1 1…0 0 0 0 0 0
//0 0 0 0 0 0…or…0 0 0 0 0 0
//0 0 0 0 0 0…0 0 0 0 0 0
//0 0 0 0 0 0…1 1 1 1 1 1
//0 0 0 0 0 0…0 0 0 0 0 0
//0 0 0 0 0 0…0 0 0 0 0 0

//depending on where the object has been dropped…

//as you can see, instead of setting a single cell of the array it sets an entire line…

//I really don’t have a clue what could be the problem with this single
//line of code, but this is definately where the problem lies!!!

trace(1000000);
for (num3=0; num3<=5; num3++)
{ for (num4=0; num4<=6; num4++)
{ trace(_global.cogarray[num3,num4]);
}
}
trace(1000000);

_global.num1glob=num1;
_global.num2glob=num2;
overpeg=1;
oddeven=(num1+num2)%2

checkmatrix(num1,num2);

if (_global.matflag[1]>0){
if (oddeven<1)
{
_global.cogrot[1]=-5;
}
if (oddeven>0)
{
_global.cogrot[1]=5;
}}
_global.matflag[1]=0;
}
}
}
}
}
}
if (overpeg<1)
{
this._x=initx;
this._y=inity;
}
}

you want to trace the content of an array?
just do trace(_global.cogarray[]);
instead of trace(_global.cogarray[num3,num4]);
for it will output just the last called value at element ‘num4’ from that array

What’s the purpose of [color=blue][color=Black]_global.cogarray[num1,num2]=1; ?
do you want to assign the value 1 to both elements?
then just do: [/color][/color][color=blue][color=Black]_global.cogarray[0]=1; [/color][/color][color=blue][color=Black]_global.cogarray[1]=1;
[/color][/color]

mediamonkey, the traces i put around the single line in question are just for debugging purposes. what i need to do is set individual cells of a 2-d array to allow the movie to be able to tell where on a grid is taken up by a spinning cog… As you can see (or not) from my diagrams of the array as it currently stands, the whole row in question is being set by the line:-

_global.cogarray[num1,num2]=1;

this is where my problem lies, using trace wouldn’t help me i don’t think!

if you are on msn get in touch through [email protected] and i can more fully explain the concept.

thanx for your time though…