Hey, people!
I’ve got the following problem: I’m trying to generate a menu using attachmovie, and this menu will load several images. the idea is fine, lol.
But what is really happening is that, as I click on any button, it just use the last array value, instead of assigning one value to each button separately.
The code below can illustrate this, but only with a trace. Where is my mistake?
Thanks a lot for the help.
Here goes the code:
// create the pics array:
var fotos:Array = new Array();
fotos = ["01.jpg","02.jpg","03.jpg","04.jpg","05.jpg","06.jpg","07.jpg","cobra_gde.jpg"];
_root.transicoes.foto_antiga.loadMovie(fotos[0]);
//create pictures menu:
for (i=0;i<fotos.length;i++){
botao_mc = attachMovie("button_mc","button"+i,_root.getNextHighestDepth());
foto_atual = fotos*;
//buttons identifiers:
if(i<9) {
indice = i+1;
botao_mc.legenda = "0"+indice;
}else{
indice = i+1;
botao_mc.legenda = indice;
}
//buttons position:
botao_mc._x = 10;
if(i == 0){
botao_mc._y = 10;
}else{
botao_mc._y = 10 + (botao_mc._height*i) + 2;
}
//button animation:
botao_mc.onEnterFrame = function(){
if(this.hitTest(_xmouse,_ymouse,true)){
this.nextFrame();
}else{
this.prevFrame();
}
}
//button actions
botao_mc.botao.onRelease = function(){
trace(foto_atual);
}
}