hi everyone,
i’ve been using attachmovieclip and sound methods in AS2 successfully, but not sure how to do it in AS3.
it’s for a free Lao language learning website, and it has a box that the user clicks on to cycle through the characters.
I want them to be able to click on the symbol and for it to play the relevant embedded sound from the library. (NB I want to use embedded sound so that ppl can download the swf for offline use).
[INDENT]consarray[0] = [“aw”, “\u0EAD”];
consarray[1] = [“baw”, “\u0E9A”];
[/INDENT]
I cycle through an array formatted like above, with the second item being the unicode ref.
What I was thinking I needed to do was within the event listener I have setup at the moment (that works) is use the sound method.
So I think I need to use something like the following, or have the variable outside, to be honest I’m not quite sure.
[INDENT]function onClick(event:*):void {
var soundstring = “cf”+(consarray[arrayposition][0])
trace(soundstring);
var channel:SoundChannel = soundstring.play();
}
[/INDENT]I guess I need to know if
- I need to initialise a variable for each of the embedded sounds in my library? (I’ll end up having around 200!!)
- if so, is there a quick way of doing this?
- if I have a statement like this
[INDENT]var channel:SoundChannel = soundstring.play();
[/INDENT]can soundstring be a string variable that I can call? I get an error saying a value cannot be a function, which I guess answers my question with a no, but then how do I do this?
Apologies I have been trying to read the tutorials and FAQs but I’m still not 100% on this.
Any recommendations/help would be greatly appreciated.
Thanks