I made a keyboard MovieClip full of other movieclips for the keyboard buttons. This is for a touch screen application.
My thought is that the best we to handle this is to set up an event listener for the entire Keyboard movieclip instance.
When the keys are touched, I find out what key letter to print to a text field by capturing the movie clip instance names:
and then using the buttonName to ascertain what to type:
var keyed:String = buttonName.slice(3);
I have my mc names set up like “keyA, keyB, key1, [email protected] …etc”, hence the slice.
I then have a case/switch that determines whether to print the character to an input field or to run a “backspace”, “submit” etc function.
All of this works great except that, when the user touches anywhere there isn’t a button, I still have an event firing off. When I trace buttonName for this, it traces “tance30”… What the heck is that? “instance 30”? Where is instance 30?? How do I make it not send an event?
Of coarse, I could just have a case that does nothing when “tance30” is detected… but will it always be “tance30”? Maybe in this app, but I have a feeling that this changes depending on the number of MCs present.
Maybe I’m going about this all wrong and this is not the best way to capture the events in a “keyboard” movieclip.
I would like some help with this if possible, thanks.