/* Copyright (c) 2007 Joa Ebert and Thibault Imbert Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package org.wiiflash.events { import flash.events.Event; /** * WiiFlash dispatches ButtonEvent objects when a user interacts with buttons on a Wiimote. * * @author Joa Ebert * @author Thibault Imbert */ public final class ButtonEvent extends Event { //----------------------------------------------------------------------------------- // Wiimote Buttons //----------------------------------------------------------------------------------- /** * Type of the 1 press event. */ public static const ONE_PRESS: String = 'onePress'; /** * Type of the 1 release event. */ public static const ONE_RELEASE: String = 'oneRelease'; /** * Type of the 2 press event. */ public static const TWO_PRESS: String = 'twoPress'; /** * Type of the 2 release event. */ public static const TWO_RELEASE: String = 'twoRelease'; /** * Type of the A press event. */ public static const A_PRESS: String = 'aPress'; /** * Type of the A release event. */ public static const A_RELEASE: String = 'aRelease'; /** * Type of the B press event. */ public static const B_PRESS: String = 'bPress'; /** * Type of the B release event. */ public static const B_RELEASE: String = 'bRelease'; /** * Type of the + press event. */ public static const PLUS_PRESS: String = 'plusPress'; /** * Type of the + release event. */ public static const PLUS_RELEASE: String = 'plusRelease'; /** * Type of the - press event. */ public static const MINUS_PRESS: String = 'minusPress'; /** * Type of the - release event. */ public static const MINUS_RELEASE: String = 'minusRelease'; /** * Type of the Home press event. */ public static const HOME_PRESS: String = 'homePress'; /** * Type of the Home release event. */ public static const HOME_RELEASE: String = 'homeRelease'; /** * Type of the Up press event. */ public static const UP_PRESS: String = 'upPress'; /** * Type of the Up release event. */ public static const UP_RELEASE: String = 'upRelease'; /** * Type of the Down press event. */ public static const DOWN_PRESS: String = 'downPress'; /** * Type of the Down release event. */ public static const DOWN_RELEASE: String = 'downRelease'; /** * Type of the Right press event. */ public static const RIGHT_PRESS: String = 'rightPress'; /** * Type of the Right release event. */ public static const RIGHT_RELEASE: String = 'rightRelease'; /** * Type of the Left press event. */ public static const LEFT_PRESS: String = 'leftPress'; /** * Type of the Left release event. */ public static const LEFT_RELEASE: String = 'leftRelease'; //----------------------------------------------------------------------------------- // Nunchuk Buttons //----------------------------------------------------------------------------------- /** * Type of the C press event. */ public static const C_PRESS: String = 'cPress'; /** * Type of the C release event. */ public static const C_RELEASE: String = 'cRelease'; /** * Type of the Z press event. */ public static const Z_PRESS: String = 'zPress'; /** * Type of the Z release event. */ public static const Z_RELEASE: String = 'zRelease'; //----------------------------------------------------------------------------------- //----------------------------------------------------------------------------------- // ClassicController Buttons //----------------------------------------------------------------------------------- /** * Type of the X press event. */ public static const X_PRESS: String = 'xPress'; /** * Type of the X release event. */ public static const X_RELEASE: String = 'xRelease'; /** * Type of the Y press event. */ public static const Y_PRESS: String = 'yPress'; /** * Type of the Y release event. */ public static const Y_RELEASE: String = 'yRelease'; /** * Type of the L press event. */ public static const L_PRESS: String = 'lPress'; /** * Type of the L release event. */ public static const L_RELEASE: String = 'lRelease'; /** * Type of the R press event. */ public static const R_PRESS: String = 'rPress'; /** * Type of the R release event. */ public static const R_RELEASE: String = 'rRelease'; /** * Type of the ZL press event. */ public static const ZL_PRESS: String = 'zlPress'; /** * Type of the ZL release event. */ public static const ZL_RELEASE: String = 'zlRelease'; /** * Type of the ZR press event. */ public static const ZR_PRESS: String = 'zrPress'; /** * Type of the ZR release event. */ public static const ZR_RELEASE: String = 'zrRelease'; //----------------------------------------------------------------------------------- private var _state: Boolean; /** * Creates an event object that contains information about button events. * * @param type The type of the event. Event listeners can access this information through the inherited type property. * @param state State of the button. true for down; false otherwise. */ public function ButtonEvent( type: String, state: Boolean ) { super( type, false, false ); _state = state; } /** * State of the button. true for down; false otherwise. */ public function get state(): Boolean { return _state; } } }