Whenever the cursor move over the note, it would call getCollision() function to store the name of the sprite. Can store more than one sprite in array but the normalNote() function failed to work correctly?
When I click a button which called normalNote(), it would only loop once (one note was redraw) before the pop. After the pop, it should have continue to loop until the rest of the notes from getChildbyname is redraw. Wonder if there any missing code?
private function getCollision(x:int, pt:int):void {
for(var i:int=pt;i<tickArray.length;i++) {
if(typeArray[i]=="eighth") {
var getCurrentNote:String = "note"+i;
var child:Sprite = c.getChildByName(getCurrentNote) as Sprite;
drawEighthUp(child,"-","-",0xff0000);
tempNote.push(getCurrentNote);
}
}
}
private function normalNote():void {
for(var iii:int=0;iii<tempNote.length;iii++) {
var child:Sprite = c.getChildByName(tempNote[iii]) as Sprite;
trace("tt",tempNote.length);
trace("iii",iii);
var asd:String = tempNote[iii].toString();
var idx:int = int(asd.substr(4));
if(typeArray[idx]=="eighth") {
drawEighthUp(child,"-","-",0x000000);
tempNote.pop();
}
}
}