Copy link to clipboard
Copied
Im using this code as my background music,i want to stop the music when i leave current scene. What should i add to make it stop when i go to next scene.
import flash.media.Sound;
import flash.net.URLRequest;
import flash.media.SoundChannel;
var music2:Sound = new Sound(new URLRequest("audio/bgmusic2.mp3"));
var sc2:SoundChannel;
sc2= music2.play();
Copy link to clipboard
Copied
apply
sc2.stop();
when you go to another scene.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now