Hello,

I have an array created in a function. But i can't use the array out of the function. In the code here, the two "alert boxes" give an undefined error for the array "fighters".

I tried to put the "new array() line in the external as in the internal function, without make any difference. Can somebody help me, here ?

=> The array exist and contain the datas in the most internal function.

Code:
	fighters = new Array();
	var db = openDatabase('furfight', '1.0', 'Fighting text game', 100 * 1024 * 1024);
	db.transaction(function (tx)
		{
			
		
		// debug data :
		j1="Wolf";
		j2="Cat";
		j3="Rabbit";
		// debug data end.


		tx.executeSql('SELECT * FROM race where name IN (?,?,?)', [j1,j2,j3], function (tx, data)
			{
			for(var i = 0; i < data.rows.length; i++)
				{
				fighters[i] = new Array(data.rows.item(i).name,data.rows.item(i).strength,data.rows.item(i).agility,data.rows.item(i).dexterity,data.rows.item(i).stamina,data.rows.item(i).size);
					
				}
			
			return fighters;

			});
			alert("1 "+fighters[0][0]);
			return fighters;
			
			
		});
			alert("2 "+fighters[0][0]);