Here I will show how to create a light weight talking application in flash. It is one of the Examples I showed in the Singapore User Group Session.
Our task is fairly simple,
- Creating an audio file (preferably MP3) with all the words we want our application to speak.
- Using that audio in a movieclip as a streaming audio and placing frame labels(to another empty layer) to split the whole audio in to the words
- Using actionscript for playing the right portions of the audio to get right sentence out of it
To achieve this I’ve created a talker component which has the following main methods
- NumberInWords(number) which converts the given number to words which it can speak
- talk(data) which speaks the given number or string
- myTalker.talk(101) will speak “Singapore Dollars One Hundred and One only“
- myTalker.talk(“SG$ Two Hundred and Twenty Two only”) will speak “Singapore Dollars Two Hundred and Twenty Two only“
Using this component I’ve created a sample application [swf file size:50K] which speaks the number which is either random generated or typed in the Number field. Take a look at it below and the FLA source is available as a Ziped file [file size: 400K] here.