I’m working on an interactive Christmas card. The idea is that people are in my room, music starts playing and people can click on instruments inside my room to make that instrument play alongside the music that was already playing.
I already have different sound clips op all the instruments and I’ve made buttons of the images of those instruments. The only problem I have now is changing the volume of one of the instruments when someone presses its button. My script is this:
var basis = new Sound(this);
basis.attachSound("basis");
basis.setVolume(100);
basis.start(0,1);
guitar_b.onRelease = function () {
if (guitar_press == 0) {
guitar_press = 1;
trace(guitar_press)
}
else {
guitar_press = 0;
trace(guitar_press)
}
}
And I have a movie clip (guitar_m) with the following script:
guitar_press = 0
trace(guitar_press)
var guitar = new Sound(this);
guitar.attachSound("guitar");
guitar.start(0,1);
if (guitar_press == 1) {
guitar_press = 0;
trace(guitar_press)
guitar.setVolume(100);
}
else {
guitar_press = 1;
trace(guitarpress)
guitar.setVolume(0);
}
The variables change correctly I think, so does anyone know what the problem is?
Thanks in advance.