Hello, I have a state in which I have to create a bunch of custom text that can be clicked. This seemed pretty easy at first and I got it done but now I have to add an individual sound event to each one. Here’s what I was trying until I hit a wall:
public function CreateButton(nPosX:Number, nPoxY:Number, sClip:Sound, sWord:String)
{
var tWord:TextField = new TextField();
tWord.text = sWord;
tWord.x = nPosX;
tWord.y = nPosY;
tWord.setTextFormat(Words);
sStage.addChild(tWord);
tWordaddEventListener(MouseEvent.MOUSE_DOWN, PlaySound);
}
I was thinking that I could use something like this for each word’s sound event but I don’t know if you can somehow link individual sounds to each clickable object in AS3. Can it be done or would it be better to just scrap this?
public function PlaySound(me:MouseEvent)
{
trace("play sound");
}