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?

Was it helpful?

Solution

The sound Effect class is used to play the sound during effects like mouseDownEffect, mouseUpEffect etc, refer here for more information. If you want to play the sound through the action script you can use this.

and also check your hardware specification.

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
scroll top