How to identify device using flash actionscript3?
How 开发者_JAVA技巧can I get to know that the device is iphone or ipad using actionscript3.0?
Check out the Capabilities class: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Capabilities.html
There's no 100% method to test if something is a specific device (Adobe say to not do it), mainly because you can end up with a ball of spaghetti code that's not future proof (e.g. the resolution/dpi roughly doubled between the iPhone 3GS and the iPhone 4, and who can say what the iPhone 5/6 etc will have).
What you could use are cpuArchitecture
, manufacturer
, os
, pixelAspectRatio
, screenDPI
, screenResolutionX
, screenResolutionY
and touchscreenType
to help try and figure it out.
There's also ContextMenu.isSupported
as the context menu (what shows when you right-click on a swf) doesn't show up on smart phones or tablets (no right-click)
精彩评论