-
AS3 assign sound to keys
Iv created a virtual keyboard in flash using arrays and buttons i now want to assign a sound to all keys so that whenever they are pressed the sound will play, I'm guessing ill need to use a for loop or something but i really don't know how i would go around doing so. Please help, it is extremely urgent
-
That depends on how you named your sound files.
If you named each sound the same as the keyCode of the key that it's assigned to then you can use getDefinitionByName to create the sound just by the keyCode of the key that is pressed.
If you named the sounds differently than above, then you'll probably need an array of every sound and an array of every keyCode. When a key is pressed you find the index in the keyCode array of the pressed key then use that index to find the appropriate sound.
-
Originally Posted by 5Five555
That depends on how you named your sound files.
If you named each sound the same as the keyCode of the key that it's assigned to then you can use getDefinitionByName to create the sound just by the keyCode of the key that is pressed.
If you named the sounds differently than above, then you'll probably need an array of every sound and an array of every keyCode. When a key is pressed you find the index in the keyCode array of the pressed key then use that index to find the appropriate sound.
i dont have a sound yet but when i get one i just want that one sound to play every time a key is pressed. for example like the sound on the iphone keyboard when typing. how would one go about doing so
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|