Skip to main content
Known Participant
September 28, 2011
Answered

Does anyone have an easier way of playing sounds?

  • September 28, 2011
  • 2 replies
  • 973 views

I've been learning AS3 this year and so far the most tricky and annoying thing for me is the way the Sound Channel works.

I have a movieclip holder with around 20 frames, with animation on each frame.

I have been coding my sound effects, but soon I'll need a Voiceover track on each frame. I don't want to have

to write tons of code for each one, playing them and stopping them if the user toggles back and forth.

Is there a simple way of doing this? I tried adding sounds on the timeline using 'event', but they don't stop

playing if you go to a new frame.

Any ideas?

Thanks,

Matt

This topic has been closed for replies.
Correct answer Colin Holgate

Yes you can have external MP3 files, so long as you have added the files in the General tab of the iOS settings.

stopAll() will stop sounds going right now. You would do that before going to the destination frame, and then its event sound should play ok.

2 replies

Colin Holgate
Inspiring
September 28, 2011

If you use external MP3 files you could have an array of the file names, or construct the filename based on the frame number. Then you would do a SoundMixer.stopAll() to stop any other sounds playing, and then play the frame's external MP3.

The SoundMixer.stopAll() ought to work for the timeline Event sound version too.

monkey500Author
Known Participant
September 28, 2011

Thanks Colin,

Firstly - Is it ok to use external sound files in AIR for iOS? Does it compile everything into the ipa?

If I use a 'stopAll' or frame 2 and then play a new sound on that frame, will it not be silent?

Colin Holgate
Colin HolgateCorrect answer
Inspiring
September 28, 2011

Yes you can have external MP3 files, so long as you have added the files in the General tab of the iOS settings.

stopAll() will stop sounds going right now. You would do that before going to the destination frame, and then its event sound should play ok.

Known Participant
September 28, 2011
monkey500Author
Known Participant
September 28, 2011

thanks, but I know about that link, and that's exactly the kind of code I want to avoid!

Known Participant
September 28, 2011

Well if you want to avoid the AS3 way then I see no solution.