Hey, im trying to figure out how to do this and keep mucking it up. Basically I have a button and when I press it plays a sound once. WHich is fine everything is working here. What I want to do is create a keyboard event so that when I hold the shift key and press the button my sound will loop instead.
my code for this- which is wrong- looks like this (blue1 is the button, d1 is the sound, drums is the sound channel, you can ignore the light):
ActionScript Code: blue1.addEventListener(MouseEvent.CLICK,myCallback);d1.addEventListener(ProgressEvent.PROGRESS, onLoadProgress1);stage.addEventListener(MouseEvent.CLICK, clickListener);function clickListener(blue1:MouseEvent):void{ if (blue1.shiftKey) { trace("Clicked"); light2.alpha = 0; light3.alpha = 0; light4.alpha = 0; light.alpha = 100; drums.stop(); drums = d1.play(0,999); trace("Shift+click detected"); }}
Please any help on this will lead to a massive amount of possibilities. Cheers for your time.
--addition--
Is it possible to create a button than will do the same as the shift key.
Keyboard event with button push
Monday, May 7, 2012
[Action Script] Keyboard event with button push May,2012
Posted by Bimo Hery Prabowo at 3:13 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment