Skip to main content
fzl_rshd
Inspiring
August 15, 2024
Answered

Can anyone to explain to define Adobe AIR Platform in PC or smartphone in AS3/AS?

  • August 15, 2024
  • 3 replies
  • 474 views

Hi, i'm Faizal Arshad Putra Adika. I want anyone to explain AS3/AS code to compare Adobe AIR platform in PC or smartphone. this is a sample code:

if(adobe_air_platform_in_pc)
{
 trace("You're using Adobe AIR Platform in PC");
}
if(adobe_air_platform_in_smartphone)
{
 trace("You're using Adobe AIR Platform in Smartphone");
}

 So, i can make and export a game for PC and smartphone in one project without creating a second ".fla" project, i just use in one "fla" file.

This topic has been closed for replies.
Correct answer JoãoCésar17023019

Hi.

 

Use the Capabilities class. For example:

import flash.system.Capabilities;

function isAndroid():Boolean
{
	return (Capabilities.version.substr(0,3) == "AND");
}

function isIOS():Boolean
{
	return (Capabilities.version.substr(0,3) == "IOS");
}

function isMobile():Boolean
{
	return (isAndroid() || isIOS());
}

if (isMobile())
{
	// your mobile code
}
else
{
	// your desktop code
}

 

I hope this helps.

 

Regards,

JC

3 replies

JoãoCésar17023019
Community Expert
JoãoCésar17023019Community ExpertCorrect answer
Community Expert
August 15, 2024

Hi.

 

Use the Capabilities class. For example:

import flash.system.Capabilities;

function isAndroid():Boolean
{
	return (Capabilities.version.substr(0,3) == "AND");
}

function isIOS():Boolean
{
	return (Capabilities.version.substr(0,3) == "IOS");
}

function isMobile():Boolean
{
	return (isAndroid() || isIOS());
}

if (isMobile())
{
	// your mobile code
}
else
{
	// your desktop code
}

 

I hope this helps.

 

Regards,

JC

Community Expert
August 20, 2024

This is good JC. Thanks for sharing.

kglad
Community Expert
Community Expert
August 15, 2024

you can use animate to create ios and android apps.  that said, your code makes no sense because you can't run animate on mobiles.

kglad
Community Expert
Community Expert
August 15, 2024

in the future, to find the best place to post your message, use the list here, https://community.adobe.com/

p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.



<"moved from using the community">
fzl_rshd
fzl_rshdAuthor
Inspiring
August 20, 2024

thank you

kglad
Community Expert
Community Expert
August 20, 2024

you're welcome.