I'm having a problem with parameters for my function. She is not getting the parameter I step into it. Here is the code below:
function gerarescala(e:MouseEvent):void
{
var tom:String = texto.text;
var escala:Array = new Array('C','C#','Db', ...);
var container:Array = new Array([vazio]); //Este array vai receber elementos de acordo com os elementos do array escala.
var pesquisa,i:Number;
[Aqui vai o Código preenchendo o array container] ...
[A função "imp", é muito extensa, então esse é só um trecho, mas é a mesma coisa em toda a função]
function imp(pos:String):String {
var retorno:String;
if (pesquisa == 1)
{
if (pos == "D#")
{
retorno = container[3];
}
else if (pos == "F")
{
retorno = container[6];
}
return retorno;
}//fim func imp
}//Fim func grarescala
In the course of the code I want to do, I'll call the function as follows: imp (container [3]); passing an element of the container array to my function, however I tested it and when I execute it I see that it returns "null" to me. I already checked with direct string entries and it worked, it just does not work with that array parameter that I pass to it. The rest of the code is all working and everything is fine, the only thing that is giving problem is with the parameter.
I noticed that the imp function is not seeing the array container, and I already put the imp function outside of the main function, but if I do this the imp function will not see any variables, and if I take the variables out of the main function it it will not work the way I want.
Any suggestions ??