- FLASH ACTIONSCRIPT 3.0 PASS SOUND TO FUNCITON HOW TO
- FLASH ACTIONSCRIPT 3.0 PASS SOUND TO FUNCITON CODE
![flash actionscript 3.0 pass sound to funciton flash actionscript 3.0 pass sound to funciton](https://img.yumpu.com/51126926/1/500x640/actionscript-310-gameprogramming-q-7619kb-jul-28-2010-08-.jpg)
We set the volume to 0 or 1, depending on the isMuted variable. Var transform:SoundTransform = musicChannel.soundTransform This function mutes or unmutes depending on the variable condition. Mute or unmute depending on that variable above. I'd imagine you want your music looped, so int.MAX_VALUE accommodates for that.
FLASH ACTIONSCRIPT 3.0 PASS SOUND TO FUNCITON CODE
Keep it separate, in case you need to bypass the startMusic code for some reason.*/ Note these match the song declarations above.*/
![flash actionscript 3.0 pass sound to funciton flash actionscript 3.0 pass sound to funciton](https://www.senocular.com/flash/tutorials/as3withflashcs3/index_files/image003.jpg)
*Depending on the targetScene number, set the correct song name. Alternatively, you can make this work with the stage name as a String.*/įunction startMusic(targetScene:int):void *This function sets the target song based on location.
![flash actionscript 3.0 pass sound to funciton flash actionscript 3.0 pass sound to funciton](https://koenig-media.raywenderlich.com/uploads/2011/10/SettingDocumentClass.png)
Var musicChannel:SoundChannel = new SoundChannel() Create a sound channel for playing audio. Alternatively, you could just name this an int and store the scene number. *Create a string variable for the name of the song that should be playing.
![flash actionscript 3.0 pass sound to funciton flash actionscript 3.0 pass sound to funciton](https://image.slidesharecdn.com/adobe-actionscript3-140101103637-phpapp01/95/adobe-action-script-30-programming-36-638.jpg)
Create a variable to indicate whether the music is muted. Scene 1 > Setting > Option > Audio/Sound (play/mute) <- i put this code here I found these codes in other website, i think these code will help me, I tried,īut at the end, i just make myself more confused.
FLASH ACTIONSCRIPT 3.0 PASS SOUND TO FUNCITON HOW TO
So how to make all sound in each scene are mute, but all audio are play? How do I call sound and audio for each scene(sound) and frame(audio)?Įxample, right now in scene 3, if i mute sound and play audio, Scene 1 > Setting > Option > Audio/Sound (play/mute) The problem is each scene has setting button, in setting button has option buttonįor option button have two button, audio button and sound button, either to mute or play. Sound - background music for game (use looping)Īudio - dialogue, shoot sound, explosion, etc (by frame)