Targeting Flash Player, publishing to mobiles

Software: Other

MJJames, Newbie
Posted: 05 March 2014 02:18 PM   Total Posts: 3

Hi,

Since we have to target Flash Player for 3D projects, I’m struggling to retain some important AIR functionality for Android:

NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, DeactivateDevice);
NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, ReactivateDevice);

I get this error in Flash CS6:
1120: Access of undefined property NativeApplication.

Or this if I try to import the class manually:
1172: Definition flash.desktop:NativeApplication could not be found.

Is it possible to have the best of both worlds? How are developers handling things like this in their mobile projects?

   

Avatar
Fabrice Closier, Administrator
Posted: 05 March 2014 02:28 PM   Total Posts: 1265   [ # 1 ]

Looks like you do not compile for AIR.

   

MJJames, Newbie
Posted: 05 March 2014 02:41 PM   Total Posts: 3   [ # 2 ]

But if I did that, Context3D wouldn’t be available would it? I’m not sure how to bridge the gap between what 3D needs and what mobiles need.

   

Avatar
Fabrice Closier, Administrator
Posted: 05 March 2014 03:49 PM   Total Posts: 1265   [ # 3 ]

All you can do in the player, you can in AIR as well.
In AIR however, you can do much more and that includes Stage3D.
That’s why if you use an AIR only class such as the NativeApplication that you get errors if you publish for the flash player.

Similar to an embed in an html file for a browser, your manifest must be edited as well. renderMode set to direct and depthAndStencil set to true in the initialWindow node. You also need next to size, icons, etc..  to set the node supportedProfiles to mobileDevice. You will also if you want more than the defaults, define some platform specific nodes for android or ios. Adobe has pages dedicated to these and google will find them in less time than I would type an url smile

   

Avatar
mrpinc, Sr. Member
Posted: 05 March 2014 03:55 PM   Total Posts: 119   [ # 4 ]

You should use Compiler constants to separate your web/desktop/mobile builds.
That way AIR classes only get compiled into AIR builds.

Here is an article with more info:

http://divillysausages.com/blog/as3_conditional_compilation

   

MJJames, Newbie
Posted: 06 March 2014 06:41 AM   Total Posts: 3   [ # 5 ]

Turns out all I can still use AIR for 3D if I set the render mode to “GPU” - even though I must compile it as “direct” in the app descriptor.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X