Return to Snippet

Revision: 46746
at May 24, 2011 16:05 by chrisaiv


Initial Code
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);

// Key Handling
public function onKeyDownHandler( e:KeyboardEvent ):void 
{
	trace("Key Down:" + e.charCode + ":" + e.keyCode);
	
	switch( e.keyCode )
	{
		case 16777227:	// rev
			break;
		
		case 16777226:	// fwd
			break;
		
		case 16777223:	// play
		
		case 13: // ok,enter
			break;
		
		case 16777225:	// stop

			break;
		
		case 16777224:	// pause

			break;
		
		case 16777220:	// ch+
		
		case 38:		// up
			break;
		
		case 16777221:	// ch-
		
		case 40:		// down
			break;
		
		case 62720:		// A - remote
		
		case 65:		// A - keyb
		
		case Keyboard.RIGHT:
			break;
		
		case Keyboard.LEFT:
			break;		
	}
}

Initial URL

                                

Initial Description
Whenever you press on a remote control button (through wireless), Flash can detect what button is being pressed

Initial Title
As3: Detect Remote Control Buttons using Key Codes

Initial Tags

                                

Initial Language
ActionScript 3