Total Pageviews

Monday, May 26, 2014

Event System

Event System
វាជា system events ដែលត្រូវ dispatched ក្នុងការ notify កម្មវិធីនៃ external events ដូចជានៅពេលដែល device ត្រូវការ suspend or exit កម្មវិធី។ Events ទាំងអស់នេះគ្រាន់តែផ្ងើរទៅកាន់ global runtime object
Properties:
event.name
វាជា String “system”
event.type
វាប្រើសំរាប់កំនត់អត្តសញ្ញាណនៃប្រភេទរបស់ system event ដែលកើតឡើង។ វាអាចមានមួយដូចចំណោមខាងក្រោមះ
"applicationStart" occurs when the application is launched and all code in main.lua is executed.
"applicationExit" occurs when the user or OS task manager quits the application.
"applicationSuspend" occurs when the device needs to suspend the application such as during a phone call or if the device goes to sleep (from inactivity or user action). In the simulator, this corresponds to selecting "Suspend" from the Hardware menu. During suspension, no events (not even enterFrame events) are sent to the application while suspended, so if you have code that depends on time, you should account for the time lost to an application being suspended.
"applicationResume" occurs when the application resumes after a suspend. On the device, this occurs if the application was suspended because of a phone call or sleep. In the simulator, this corresponds to selecting "Resume" from the Hardware menu.
"applicationOpen" occurs when the application is asked to open a URL resource (iOS-only)
ចំណាំះ នៅពេលដែលអ្នកប្រើប្រាស់ force quits ចេញពីកម្មវិធី the applicationExit event ដែលមិនបាន fire (on any platform)
សូមមើលកូដះ
local function onSystemEvent( event )
    print( "System event name and type: " .. event.name, event.type )
end
Runtime:addEventListener( "system", onSystemEvent )

event.url
វាជា URl ដែលកំនត់នៅប្រភពក្នុងការបើកនៅកម្មវិធី។ property នេះគ្រាន់តែចាកចេញនៅពេលដែល event.type is “applicationOpen”

ចំណាំះ វាមានតែ IOS only សូមមើល apple RUL Scheme Reference សំរាប់ apple registered schemes for URL’s

No comments:

Post a Comment