Package | org.wiiflash |
Class | public final class Wiimote |
Implements | flash.events.IEventDispatcher |
It is important to remember the following information regarding the motion sensors:
var wiimote:Wiimote = new Wiimote(); wiimote.addEventListener( Event.CONNECT, onWiimoteConnect ); wiimote.connect();
wiimote.addEventListener( ButtonEvent.A_PRESS, onWiimoteAPress ); wiimote.addEventListener( ButtonEvent.A_RELEASE, onWiimoteARelease );
See also
Property | Defined by | ||
---|---|---|---|
a : Boolean [read-only]
Indicates if button A is pressed.
| Wiimote | ||
b : Boolean [read-only]
Indicates if button B is pressed.
| Wiimote | ||
balanceBoard : BalanceBoard
[read-only]
The Balance Board that is attached to this Wiimote object.
| Wiimote | ||
batteryLevel : Number [read-only]
Wiimote battery level from 0 to 1 (full batteries).
| Wiimote | ||
classicController : ClassicController
[read-only]
The ClassicController that is attached to this Wiimote object.
| Wiimote | ||
connected : Boolean [read-only]
Indicates whether this Wiimote object is currently connected to the WiiFlash server.
| Wiimote | ||
down : Boolean [read-only]
Indicates if button Down is pressed.
| Wiimote | ||
hasBalanceBoard : Boolean [read-only]
Indicates if a Balance Board is attached to this Wiimote object.
| Wiimote | ||
hasClassicController : Boolean [read-only]
Indicates if a Classic Controller is attached to this Wiimote object.
| Wiimote | ||
hasNunchuk : Boolean [read-only]
Indicates if a Nunchuk is attached to this Wiimote object.
| Wiimote | ||
home : Boolean [read-only]
Indicates if button Home is pressed.
| Wiimote | ||
id : uint [read-only]
Indicates Wiimote ID, for multiple wiimotes handling
| Wiimote | ||
ir : IR
[read-only]
The IR data that this Wiimote object recieves.
| Wiimote | ||
leds : int
Bitmask of the Wiimote's LEDs.
| Wiimote | ||
left : Boolean [read-only]
Indicates if button Left is pressed.
| Wiimote | ||
minus : Boolean [read-only]
Indicates if button - is pressed.
| Wiimote | ||
mouseControl : Boolean
Flag of the Wiimote's mouse control.
| Wiimote | ||
nunchuk : Nunchuk
[read-only]
The Nunchuk that is attached to this Wiimote object.
| Wiimote | ||
one : Boolean [read-only]
Indicates if button 1 is pressed.
| Wiimote | ||
pitch : Number [read-only]
Pitch angle of the Wiimote in radians.
| Wiimote | ||
plus : Boolean [read-only]
Indicates if button + is pressed.
| Wiimote | ||
right : Boolean [read-only]
Indicates if button Right is pressed.
| Wiimote | ||
roll : Number [read-only]
Roll angle of the Wiimote in radians.
| Wiimote | ||
rumble : Boolean
Flag of the Wiimote's rumble state.
| Wiimote | ||
rumbleTimeout : uint
Flag for a rumble that stops after given amount of milliseconds.
| Wiimote | ||
sensorX : Number [read-only]
Value of the x acceleration sensor.
| Wiimote | ||
sensorY : Number [read-only]
Value of the y acceleration sensor.
| Wiimote | ||
sensorZ : Number [read-only]
Value of the z acceleration sensor.
| Wiimote | ||
two : Boolean [read-only]
Indicates if button 2 is pressed.
| Wiimote | ||
up : Boolean [read-only]
Indicates if button Up is pressed.
| Wiimote | ||
yaw : Number [read-only]
Yaw angle of the Wiimote in radians.
| Wiimote |
Method | Defined by | ||
---|---|---|---|
Wiimote()
Creates a new Wiimote object.
| Wiimote | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with a Wiimote object so that the listener receives notification of an event.
| Wiimote | ||
close():void
Closes the connection between this Wiimote object and the WiiFlash server.
| Wiimote | ||
connect(host:String = "127.0.0.1", port:int = 0x4a54):void
Connects the Wiimote to the specified host and port.
| Wiimote | ||
dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
| Wiimote | ||
hasEventListener(type:String):Boolean
Checks whether the Wiimote object has any listeners registered for a specific type of event.
| Wiimote | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the Wiimote object.
| Wiimote | ||
toString():String
Returns the string representation of the specified object.
| Wiimote | ||
update(pack:ByteArray):void
| Wiimote | ||
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this Wiimote object or any of its ancestors for the specified event type.
| Wiimote |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched when button A has been pressed. | Wiimote | |||
Dispatched when button A has been released. | Wiimote | |||
Dispatched when the Balance Board has been connected to Wiimote. | Wiimote | |||
Dispatched when the Classic Controller has been disconnected from Wiimote. | Wiimote | |||
Dispatched when button B has been pressed. | Wiimote | |||
Dispatched when button B has been released. | Wiimote | |||
Dispatched when the Classic Controller has been connected to Wiimote. | Wiimote | |||
Dispatched when the Classic Controller has been disconnected from Wiimote. | Wiimote | |||
Dispatched when a Wiimote object has successfully connected to the WiiFlash server. | Wiimote | |||
Dispatched when Nunchuk button C has been pressed. | Wiimote | |||
Dispatched when Nunchuk button C has been released. | Wiimote | |||
Dispatched when button Down has been pressed. | Wiimote | |||
Dispatched when button Down has been released. | Wiimote | |||
Dispatched when button Home has been pressed. | Wiimote | |||
Dispatched when button Home has been released. | Wiimote | |||
Dispatched when a Wiimote object could not establish a connection. | Wiimote | |||
Dispatched when Point 1 of the IR sensor bar has been found. | Wiimote | |||
Dispatched when Point 1 of the IR sensor bar has been lost. | Wiimote | |||
Dispatched when Point 2 of the IR sensor bar has been found. | Wiimote | |||
Dispatched when Point 2 of the IR sensor bar has been lost. | Wiimote | |||
Dispatched when button Left has been pressed. | Wiimote | |||
Dispatched when button Left has been released. | Wiimote | |||
Dispatched when button - has been pressed. | Wiimote | |||
Dispatched when button - has been released. | Wiimote | |||
Dispatched when Nunchuk has been connected to Wiimote. | Wiimote | |||
Dispatched when Nunchuk has been disconnected from Wiimote. | Wiimote | |||
Dispatched when button 1 has been pressed. | Wiimote | |||
Dispatched when button 1 has been released. | Wiimote | |||
Dispatched when button + has been pressed. | Wiimote | |||
Dispatched when button + has been released. | Wiimote | |||
Dispatched when button Right has been pressed. | Wiimote | |||
Dispatched when button Right has been released. | Wiimote | |||
Dispatched when button 2 has been pressed. | Wiimote | |||
Dispatched when button 2 has been released. | Wiimote | |||
Dispatched when Wiimote data has been updated. | Wiimote | |||
Dispatched when button Up has been pressed. | Wiimote | |||
Dispatched when button Up has been released. | Wiimote | |||
Dispatched when Nunchuk button Z has been pressed. | Wiimote | |||
Dispatched when Nunchuk button Z has been released. | Wiimote |
Constant | Defined by | ||
---|---|---|---|
LED1 : int = 1 [static]
The first LED.
| Wiimote | ||
LED2 : int = 2 [static]
The second LED.
| Wiimote | ||
LED3 : int = 4 [static]
The third LED.
| Wiimote | ||
LED4 : int = 8 [static]
The fourth LED.
| Wiimote |
a | property |
a:Boolean
[read-only]Indicates if button A is pressed.
Implementation public function get a():Boolean
b | property |
b:Boolean
[read-only]Indicates if button B is pressed.
Implementation public function get b():Boolean
balanceBoard | property |
balanceBoard:BalanceBoard
[read-only]The Balance Board that is attached to this Wiimote object.
Implementation public function get balanceBoard():BalanceBoard
batteryLevel | property |
batteryLevel:Number
[read-only]Wiimote battery level from 0 to 1 (full batteries).
Implementation public function get batteryLevel():Number
var battery:Number = wiimote.batteryLevel;
classicController | property |
classicController:ClassicController
[read-only]The ClassicController that is attached to this Wiimote object.
Implementation public function get classicController():ClassicController
connected | property |
connected:Boolean
[read-only]Indicates whether this Wiimote object is currently connected to the WiiFlash server.
Implementation public function get connected():Boolean
down | property |
down:Boolean
[read-only]Indicates if button Down is pressed.
Implementation public function get down():Boolean
hasBalanceBoard | property |
hasBalanceBoard:Boolean
[read-only]Indicates if a Balance Board is attached to this Wiimote object.
Implementation public function get hasBalanceBoard():Boolean
hasClassicController | property |
hasClassicController:Boolean
[read-only]Indicates if a Classic Controller is attached to this Wiimote object.
Implementation public function get hasClassicController():Boolean
hasNunchuk | property |
hasNunchuk:Boolean
[read-only]Indicates if a Nunchuk is attached to this Wiimote object.
Implementation public function get hasNunchuk():Boolean
home | property |
home:Boolean
[read-only]Indicates if button Home is pressed.
Implementation public function get home():Boolean
id | property |
id:uint
[read-only]Indicates Wiimote ID, for multiple wiimotes handling
Implementation public function get id():uint
ir | property |
ir:IR
[read-only]The IR data that this Wiimote object recieves.
Implementation public function get ir():IR
leds | property |
leds:int
[read-write]Bitmask of the Wiimote's LEDs.
Implementation public function get leds():int
public function set leds(value:int):void
wiimote.leds = Wiimote.LED1 | Wiimote.LED4;
left | property |
left:Boolean
[read-only]Indicates if button Left is pressed.
Implementation public function get left():Boolean
minus | property |
minus:Boolean
[read-only]Indicates if button - is pressed.
Implementation public function get minus():Boolean
mouseControl | property |
mouseControl:Boolean
[read-write]Flag of the Wiimote's mouse control.
Implementation public function get mouseControl():Boolean
public function set mouseControl(value:Boolean):void
wiimote.mouseControl = true;
wiimote.mouseControl = false;
nunchuk | property |
nunchuk:Nunchuk
[read-only]The Nunchuk that is attached to this Wiimote object.
Implementation public function get nunchuk():Nunchuk
one | property |
one:Boolean
[read-only]Indicates if button 1 is pressed.
Implementation public function get one():Boolean
pitch | property |
pitch:Number
[read-only]Pitch angle of the Wiimote in radians. This value is scaled by the calibration data that has been read from the Wiimote.
Implementation public function get pitch():Number
plus | property |
plus:Boolean
[read-only]Indicates if button + is pressed.
Implementation public function get plus():Boolean
right | property |
right:Boolean
[read-only]Indicates if button Right is pressed.
Implementation public function get right():Boolean
roll | property |
roll:Number
[read-only]Roll angle of the Wiimote in radians. This value is scaled by the calibration data that has been read from the Wiimote.
Implementation public function get roll():Number
rumble | property |
rumble:Boolean
[read-write]Flag of the Wiimote's rumble state.
Implementation public function get rumble():Boolean
public function set rumble(value:Boolean):void
wiimote.rumble = true;
wiimote.rumble = false;
rumbleTimeout | property |
rumbleTimeout:uint
[read-write]Flag for a rumble that stops after given amount of milliseconds.
Implementation public function get rumbleTimeout():uint
public function set rumbleTimeout(value:uint):void
wiimote.rumbleTimeout = 1000;
sensorX | property |
sensorX:Number
[read-only]Value of the x acceleration sensor. This value is scaled by the calibration data that has been read from the Wiimote.
Implementation public function get sensorX():Number
sensorY | property |
sensorY:Number
[read-only]Value of the y acceleration sensor. This value is scaled by the calibration data that has been read from the Wiimote.
Implementation public function get sensorY():Number
sensorZ | property |
sensorZ:Number
[read-only]Value of the z acceleration sensor. This value is scaled by the calibration data that has been read from the Wiimote.
Implementation public function get sensorZ():Number
two | property |
two:Boolean
[read-only]Indicates if button 2 is pressed.
Implementation public function get two():Boolean
up | property |
up:Boolean
[read-only]Indicates if button Up is pressed.
Implementation public function get up():Boolean
yaw | property |
yaw:Number
[read-only]Yaw angle of the Wiimote in radians. This value is scaled by the calibration data that has been read from the Wiimote.
A sensor measures only acceleration. The default acceleration a sensor can measure is the gravity vector that is pointing downwards. This has no affect to the yaw angle and is the reason whil there wont be much changes in value. Using an IR sensor bar can solve this issue.
Implementation public function get yaw():Number
Wiimote | () | constructor |
public function Wiimote()
Creates a new Wiimote object.
— Thrown if more than four Wiimote objects have been created.
|
addEventListener | () | method |
public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with a Wiimote object so that the listener receives notification of an event.
Parameterstype:String — The type of event.
|
|
listener:Function — The listener function that processes the event.
|
|
useCapture:Boolean (default = false ) — Determines whether the listener works in the capture phase or the target and bubbling phases.
|
|
priority:int (default = 0 ) — The priority level of the event listener.
|
|
useWeakReference:Boolean (default = false ) — Determines whether the reference to the listener is strong or weak.
|
See also
close | () | method |
public function close():void
Closes the connection between this Wiimote object and the WiiFlash server.
connect | () | method |
public function connect(host:String = "127.0.0.1", port:int = 0x4a54):void
Connects the Wiimote to the specified host and port.
Parametershost:String (default = "127.0.0.1 ") — The name of the host to connect to.
|
|
port:int (default = 0x4a54 ) — The port number to connect to.
|
See also
dispatchEvent | () | method |
public function dispatchEvent(event:Event):Boolean
Dispatches an event into the event flow.
Parametersevent:Event — The Event object dispatched into the event flow.
|
Boolean |
See also
hasEventListener | () | method |
public function hasEventListener(type:String):Boolean
Checks whether the Wiimote object has any listeners registered for a specific type of event.
Parameterstype:String — The type of event.
|
Boolean — A value of true if a listener of the specified type is registered; false otherwise.
|
See also
removeEventListener | () | method |
public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the Wiimote object.
Parameterstype:String — The type of event.
|
|
listener:Function — The listener object to remove.
|
|
useCapture:Boolean (default = false ) — Specifies whether the listener was registered for the capture phase or the target and bubbling phases.
|
See also
toString | () | method |
public function toString():String
Returns the string representation of the specified object.
ReturnsString — A string representation of the object.
|
update | () | method |
public function update(pack:ByteArray):void
Parameters
pack:ByteArray |
willTrigger | () | method |
public function willTrigger(type:String):Boolean
Checks whether an event listener is registered with this Wiimote object or any of its ancestors for the specified event type.
Parameterstype:String — The type of event.
|
Boolean — A value of true if a listener of the specified type will be triggered; false otherwise.
|
See also
aPress | event |
aRelease | event |
balanceBoardConnect | event |
org.wiiflash.events.WiimoteEvent
Dispatched when the Balance Board has been connected to Wiimote.
balanceBoardDisconnect | event |
org.wiiflash.events.WiimoteEvent
Dispatched when the Classic Controller has been disconnected from Wiimote.
bPress | event |
bRelease | event |
classicControllerConnect | event |
org.wiiflash.events.WiimoteEvent
Dispatched when the Classic Controller has been connected to Wiimote.
classicControllerDisconnect | event |
org.wiiflash.events.WiimoteEvent
Dispatched when the Classic Controller has been disconnected from Wiimote.
connect | event |
flash.events.Event
Dispatched when a Wiimote object has successfully connected to the WiiFlash server.
cPress | event |
org.wiiflash.events.ButtonEvent
Dispatched when Nunchuk button C has been pressed.
cRelease | event |
org.wiiflash.events.ButtonEvent
Dispatched when Nunchuk button C has been released.
downPress | event |
downRelease | event |
homePress | event |
homeRelease | event |
ioError | event |
flash.events.IOErrorEvent
Dispatched when a Wiimote object could not establish a connection.
ir1Found | event |
org.wiiflash.events.WiimoteEvent
Dispatched when Point 1 of the IR sensor bar has been found.
ir1Lost | event |
org.wiiflash.events.WiimoteEvent
Dispatched when Point 1 of the IR sensor bar has been lost.
ir2Found | event |
org.wiiflash.events.WiimoteEvent
Dispatched when Point 2 of the IR sensor bar has been found.
ir2Lost | event |
org.wiiflash.events.WiimoteEvent
Dispatched when Point 2 of the IR sensor bar has been lost.
leftPress | event |
leftRelease | event |
minusPress | event |
minusRelease | event |
nunchukConnect | event |
org.wiiflash.events.WiimoteEvent
Dispatched when Nunchuk has been connected to Wiimote.
nunchukDisconnect | event |
org.wiiflash.events.WiimoteEvent
Dispatched when Nunchuk has been disconnected from Wiimote.
onePress | event |
oneRelease | event |
plusPress | event |
plusRelease | event |
rightPress | event |
rightRelease | event |
twoPress | event |
twoRelease | event |
update | event |
upPress | event |
upRelease | event |
zPress | event |
org.wiiflash.events.ButtonEvent
Dispatched when Nunchuk button Z has been pressed.
zRelease | event |
org.wiiflash.events.ButtonEvent
Dispatched when Nunchuk button Z has been released.
LED1 | constant |
public static const LED1:int = 1
The first LED.
LED2 | constant |
public static const LED2:int = 2
The second LED.
LED3 | constant |
public static const LED3:int = 4
The third LED.
LED4 | constant |
public static const LED4:int = 8
The fourth LED.