You must create empty arrays first, like this:
// bidimensional array in AS
var matrix2:Array = [];
for(i=0;i<3;i++){
matrix2[i] = [];
for(j=0;j<3;j++){
matrix2[i][j]=0;
}
}
trace(matrix2);
-- original message --
>On Oct 31, 2005, at 7:22 AM, cornel wrote:
>> hi
>> maybe a silly question, but here i go anyway:
>> how would you write something like this in actionscript:
>>
>> int matrix[3][3];
>> for(i=0;i<3;i++)
>> for(j=0;j<3;j++)
>> matrix[i][j]=0;
>>
>> i've done something like this in my code, mtasc doesnt complained, but
>> the program doesnt work, and i have a feeling that something wrong.
>>
>> i would appreciate any help
>> cornel
>Unlike C, Actionscript can't create a two-dimensional array like that.
>var matrix = [];
>for (;i<3;i++) matrix[i] = [0];
>That's the super shorthand way of doing it.
>cheers,
>Jon
--
Best regards,
Gregory
================================
http://GOusable.com
Flash components development.
Usability services.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders