Stas52
20.08.2009, 17:54
Товарищи, подскажите, пожалуйста, где я ошибся? В мувик recipes достаем несколько объектов. При нажатии на один из объектов он должен становится сверху.
for (k=0; k<=this.count-1; k++) {
recipe_name = "recipe_" + k;
Recipe.push(recipes.attachMovie("page_new", recipe, recipes.getNextHighestDepth(), {_x:-100, _y:700}));
Recipe[k].onPress = function(){
this.swapDepths(recipes.getNextHighestDepth());
trace( Recipe[0].getDepth() + "---" + Recipe[1].getDepth() + "---" + Recipe[2].getDepth() );
}
}
Но даже когда я нажимаю только на онин объект, они все время меняются местами и Trace выводит следующее
3---1---2
3---4---2
3---1---2
3---4---2
3---4---5
6---4---5
6---7---5
6---7---8
9---7---8
9---10---8
9---10---11
for (k=0; k<=this.count-1; k++) {
recipe_name = "recipe_" + k;
Recipe.push(recipes.attachMovie("page_new", recipe, recipes.getNextHighestDepth(), {_x:-100, _y:700}));
Recipe[k].onPress = function(){
this.swapDepths(recipes.getNextHighestDepth());
trace( Recipe[0].getDepth() + "---" + Recipe[1].getDepth() + "---" + Recipe[2].getDepth() );
}
}
Но даже когда я нажимаю только на онин объект, они все время меняются местами и Trace выводит следующее
3---1---2
3---4---2
3---1---2
3---4---2
3---4---5
6---4---5
6---7---5
6---7---8
9---7---8
9---10---8
9---10---11