PDA

View Full Version : FMX Help Needed! ActionScipt for Multiple sound toggle!



Mcscratchy
April 12th, 2004, 02:44 PM
Hello All,
I have been trying to make a sound control panel in an SWF movie that toggles through about 4 different music tracks. I have not been able to get the if/else statements to work for the button. Could someone tell me what is wrong with this script(below)? 1-4 are the tracks in my library and I have made the export linkage for all them. Any help would be appreciated!

Frame Script
_root.music=true;
_root.music2=true;
techno=new Sound();
techno.attachSound("1");
techno.start();

techno1=new Sound();
techno1.attachSound("2");

techno2=new Sound();
techno2.attachSound("3");

techno3=new Sound();
techno3.attachSound("4")


Object(button) Script

on(release) {
if(_root.music == true){
techno.stop();
techno1.start();
_root.music=false;
} else {
techno1.stop();
techno2.start();
_root.music=true;
}

if(_root.music == true){
techno.stop();
techno1.start();
_root.music=false;
} else {
techno1.stop();
techno2.start();
_root.music=true;
}
}

Mcscratchy
April 12th, 2004, 06:10 PM
Never mind guys, I figured it out on my own by just nesting the if/else statements! Thanks anyways.