Bill Kotsias
Bill Kotsias

Reputation: 3368

How to tell if Flash AS3 is running in desktop or mobile browser

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?

Upvotes: 1

Views: 4793

Answers (4)

rtpenick
rtpenick

Reputation: 125

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
}

Upvotes: 1

Fans
Fans

Reputation: 79

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.

Upvotes: 1

Sam DeHaan
Sam DeHaan

Reputation: 10325

How's flash.system.Capabilities.version look?

Upvotes: 3

Engineer
Engineer

Reputation: 48793

Use flash.system.Capabilities.os to check.

Upvotes: 4

Related Questions