问题
I am developing a full-Flash site (Player 10.2).
I need to know at runtime if code is running on a desktop/mouse computer or a mobile/touch device, so that I can differentiate the input mechanism.
Is this by any means possible?
回答1:
How's flash.system.Capabilities.version look?
回答2:
Use flash.system.Capabilities.os to check.
回答3:
For AIR 3.9: Capabilities.manufacturer returns "Adobe iOS" on ipad2, "Android Linux" on Galaxy s4. Capabilities.version returns "IOS 11,9,900,117" on ipad2 and "AND 11,9,900,117" on Galaxy s4.
回答4:
You could check to see if the device has accelerometer support. If so, you know it's a mobile device. I dont know exactly what it is you would like to do so I dont know if this will work well for your project. It will distinguish mobile from desktop, though.
if(Accelerometer.isSupported){
//mobile device
//os still unknown
else{
//desktop or laptop
//os still unknown
}
来源:https://stackoverflow.com/questions/9811871/how-to-tell-if-flash-as3-is-running-in-desktop-or-mobile-browser