PDA

View Full Version : for loop button defined cannot use hitTest


raskolnikov
09-28-2006, 11:14 AM
here's a section the code:

for (var i = 0; i<this.poss.length; i++) {
prof++;
_root.attachMovie("bouton", "b"+this.poss[i].x+this.poss[i].y, prof);
_root["b"+this.poss[i].x+this.poss[i].y]._x = INITPOSX+this.poss[i].x*TAILLEPIONX+this.poss[i].x*PAS;
_root["b"+this.poss[i].x+this.poss[i].y]._y = INITPOSY+this.poss[i].y*TAILLEPIONY+this.poss[i].y*PAS;
//this controls the bloodly rules
/*
_root["b"+this.poss[i].x+this.poss[i].y].onPress = function() {
trace("this works");

};0
*/

if (_root["b"+this.poss[i].x+this.poss[i].y].hitTest(_root.slider)) {
trace("hahahahahahahah");
clicked();

}
}

all i want to do is instead of onPress I want to use the keyBoard buttons using addListener. the _root.slider is a highlighter. why the hitTest is not working? When i highlight the object nothing happens. how do i solve this?

raskol