Total Pageviews

Monday, May 26, 2014

Event Orientation

Event Orientation
សំរាប់ Event Orientation កើតឡើងនៅពេលដែល device orientation ផ្លាស់ប្តូរ (portrait, landscape) វានឹងបញ្ចូនទៅកាន់ Global object។ បច្ចុប្បន្ននៅលើ android devices orientation event ត្រូវបានកើតឡើងនៅពេល auto rotation ដាក់ជា enabled នៅក្នុង build.setting
event.type វាជាString ដែលកំនត់នៅ new orientation របស់ devices តាមខាងក្រោមះ
portrait/ landscapeLeft/ portraitUpSideDown/landscapeRight/faceUp/facedown
ចំណាំះ សំរាប់ faceUp & facedown orientation string មានតែលើ iPad
event.name វាជា String orientation
event.delta វាផ្តល់នៅ angular difference (in degrees) រវាង ending & starting orientation​ វាត្រឡប់ជា ០បើសិនជា two orientation lie in different planes
សូមមើលកូដះ
The following code demonstrates basic usage of the orientation events:
local function onOrientationChange( event )
    local currentOrientation = event.type
    print( "Current orientation: " .. currentOrientation )
end
Runtime:addEventListener( "orientation", onOrientationChange )


No comments:

Post a Comment