melody = new Sound(); melody.attachSound("melody"); melody.start(0, 999999); melody.flag = true;
on (press) { melody.flag =!melody.flag; if (melody.flag) { melody.start(); } else { melody.stop(); } }