#def Compile ( html5 target )


#1

Hello.
I’m trying use

#if mobile
someSprite.width = 200;
#end

it doesnt work on IOS for example or Android I see.

I want to check - mobile browser or desktop browser. Thanks


#2

You can’t do that with conditional compilation, that happens at compile time - you need some check that happens at runtime with a regular if.

I’m not sure if OpenFL has something built-in for this. Check out Flixel’s implementation for it, that maybe be helpful:


#3

Here is a sample of the code to detect mobile browser :


#4

Big Thanks guys!!!