ronald wrote...
If I have 3 songs, I click on the first button and the third progress bar works, I tell myself that there is a problemvalueBar[songIndex]....
valueBar[songIndex].setImage(img);
public Background() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(900, 600, 1); GreenfootImage bg = getBackground(); for(int i = 0; i<buttons.length; i++) { buttons[i] = getNewButton("BUTTON 0"+(i+1)); addObject(buttons[i],500,i*50+100); GreenfootImage img = new GreenfootImage(songs[i],30,Color.BLUE,TRANS); bg.drawImage(img,50,85+i*50); valueBar = new SimpleActor[i]; updateValueDisplay(); addObject(valueBar[i],750,i*50+100); } }
valueBar[i] = new SimpleActor();
private Actor[] valueBar = new Actor[songs.length];