event.phase

Description:

Used in the "key" listener to obtain the string name of the navigation key state (up or down). See event.keyName for key names.

Syntax:

phase = event.phase

Example:

-- Key listener
local function onKeyEvent( event )
        local phase = event.phase
        local keyName = event.keyName
        eventTxt.text = "("..phase.." , " .. keyName ..")"
 
        -- we handled the event, so return true.
        -- for default behavior, return false.
        return true
end
 
-- Add the key callback
Runtime:addEventListener( "key", onKeyEvent );

Note: Return "false" in the keyEvent listener to use the default action for the key.

Parameters:

None.

Returns:

string
Returns the state of the key pressed: "up" or "down".

Remarks:
Supported on operating systems and platforms for build numbers shown:
  • Mac OS X:
    --
  • Windows:
    --
  • iOS:
    --
  • Android:
    Build 2011.559