Playing a MXML SoundEffect in Actionscript
-
16-04-2021 - |
Question
If I have a SoundEffect in the Declarations of a MXML component and play it in Actionscript, no sound is played:
<mx:SoundEffect id="mySound" source="@Embed(source='assets/sounds/my_sound.mp3')" />
Actionscript Code:
mySound.play();
Is that supposed to happen and if so, is there a way to play a mx:SoundEffect in Actionscript?
OTHER TIPS
You can play the effect from AS with the sound property of the effect:
mySound.sound.play();
The method returns a SoundChannel
object that you can use to stop the sound.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow