I got some problems with my code, here is my code:
public function left_hand_sides(a:String):Array{
var res:Array = new Array();
var r:Array = new Array();
var i:int = 0;
var j:int = 0;
var z:int;
for(i = 0;i < this.Terminal.length;i++){
for(j = 0;j < this.Terminal*.length;++j){
z = this.Terminal*[j];
r.push(z);
}
if(r[1] == a){
res.push(r[0]);
}
r = [];
}
return res;
}
Assuming this.Terminal is a public array of my class which has 7 elements. Each element has an array. So it look like this:

when I debug this piece of code, I find some weird things happened. It didn’t run the way I think it should be. I googled some info about variable scope in AS 3 and find out some interesting info. So I changed it a little bit to make it run. Anyway, it still didn’t run. When I debug line by line, until
if(r[1] == a)
res.push(r[0]);
So can you guys please point out the mistake for me? That’d be really appreciated.