Skip to main content
Participating Frequently
December 6, 2006
Question

Can I Dynamically Link and Play Sounds?

  • December 6, 2006
  • 7 replies
  • 339 views
I am building a morse code training program for my Ham Radio Club. I am wondering how to script the code that would allow the user to type (via a virtual keyboard on the program interface) a sentence, linking each dynamically selected letter to a sound file (MP3), and then play the setence in morse code when the play button is selected? Displaying the typed text in a dynamic window is the easy part, but linking each selected letter to a sound file, and playing them in sequence is where I am stuck.

I cannot find any help for this type of script via manuals and help files. Thank you in advance for your help.

Sincerely,

David, WD8PUO
This topic has been closed for replies.

7 replies

Participating Frequently
December 13, 2006
kglad:
Have you had any luck getting that script to work yet?
Participating Frequently
December 9, 2006
kglad:
I am sorry to be so much trouble. Please let me know if I can repay you in any way. I have zipped the file and it may be downloaded at http://davidsdesign.echurchnetwork.net/FAQ/download/default.aspx
kglad
Community Expert
Community Expert
December 9, 2006
post a link to your fla that contains your sounds that have linkage ids assigned.
Participating Frequently
December 8, 2006
kglad:
While your code suggestion makes logical sense, I am unable to get it to work. Somewhere there is a breakdown, but I do not know where. Any suggestions?
kglad
Community Expert
Community Expert
December 8, 2006
you're very welcome. i really appreciate all that ham radio operators do for people in emergency situations.
Participating Frequently
December 8, 2006
Kglad:
WOW! You are amazing! It will take me a little time to sift through the code and fully appreciate all that you have sent me, but I am totally impressed! Thank you so much. I am sure that once I start putting your advice into action, that questions will arise. But I want to thank you so much for all that you have done for me already. You have enabled me to help out our radio club and its new students, and on their behalf I want to again say thank you.
kglad
Community Expert
Community Expert
December 6, 2006
if you are going to encode punctuation, in addtion to alpha-numeric characters you should probably invest the time to create an associative array. i'll explain that if that's the route you take.

in any case, you'll want to import into your library as the character sound files that you'll need. you'll want to give each a linkage id and you'll want to pick this wisely to ease your work later.

you'll want to use the onChanged property of your input textfield to store all the linkage ids (this where the associative array would be used and/or your clever choices used in assigning linkage ids) in an array.

you'll create a sound object from the flash sound class. when the submit button is pressed you'll initialize the index of your array that contains your linkage ids, you'll attach the corresponding sound and apply the start() method of your sound object.

you'll create an onSoundComplete method for your sound object (and you'll probably want small delay in executing this next step so there's some silence between characters) where you'll increment your index and attach the corresponding sound and start it.

you are done.

don't forget to include a sound that corresponds to a blank space. ie, silence for some amount time to indicate a new word.
Participating Frequently
December 6, 2006
If an array gets me to my goal, then I will need to learn how to do it...thank you.

I have already loaded the sounds into the library and have written code for each element that looks like...

(see attached code below)

This code accomplishes the function of the visual and audio preview of each letter, which is one of my goals. But I guess I need direction on how to build an array to add the additional functionality of playing the complete sentence. From what you have communicated, it sure sounds like you have a clear picture of what I need to do! So what's my next step?

David, WD8PUO
kglad
Community Expert
Community Expert
December 7, 2006
the code below is commented to explain: