• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Adobe AIR HTML Native Full Screen on Mac OS X

New Here ,
Feb 04, 2014 Feb 04, 2014

Copy link to clipboard

Copied

I am building an application in Adobe AIR for Mac in HTML/JavaScript.

What I want to do is when the application loads, make the application go into full-screen mode using the correct native full-screen found in OS X Lion and above.

e.g.

http://2.bp.blogspot.com/-VsNGB609JLw/TieZqEghrGI/AAAAAAAAAH8/JHqEzzeCq0w/s1600/Screen+Shot+2011-07-20+at+11.12.20+PM.png

This is NOT using the displayState that Flash/Flex uses.

If the users decides to exit full screen mode they will see the app in a native window and can re-enter full screen mode using the icon you get in the top-right of a window.

I've found some information about an extension here: http://forums.adobe.com/thread/1209193

FREObject _EnableFullScreenMode(FREContext ctx, void* functionData, uint32_t argc, FREObject argv[])
    
{
       
//We should be okay to do this, even on 10.6, according to this post:
       
//http://www.cocoabuilder.com/archive/cocoa/311124-implementing-full-screen-for-10-7-but-app-should-al...
       
//We can't use [NSApp mainWindow] - didn't appear to work
       
//This seems to though:
       
NSArray * allWindows = [NSApp windows];
       
if (allWindows.count > 0)
       
{
           
NSWindow *mainWindow = [allWindows  objectAtIndex: 0];
           
NSWindowCollectionBehavior behavior = [mainWindow collectionBehavior];
            behavior
|= NSWindowCollectionBehaviorFullScreenPrimary;
           
[mainWindow setCollectionBehavior:behavior];
       
}

       
//TODO: Return a boolean instead depending on if we found the main window
       
return NULL;
    
}

That looks to do what I want! But after reading the Adobe AIR docs I can't get my head around where this code should live in my app directory and how I can call it on app load.

So in my index.html I have:

$(document).ready(function() {  // Make window full-screen // CALL THE EXTENSION TO MAKE THE APPLICATION FULL_SCREEN  // Make window active window.nativeWindow.activate();  // Make it visible window.nativeWindow.visible = true;  });

The initialWindow is not visible by default using <visible>false</false> in the application descriptor XML file. And is made visible and active on the document ready as shown above.

The missing piece is loading in the extension and making the window go native full-screen.

To break this question up:

  1. Where does the extension code go? E.g. do I create an extension file and put it in any particular location in the app directory?
  2. How do I then load the extension into the application
  3. Finally how do I then do the full-screen on document ready
  4. What happens in OS X below Lion? How did full-screen work before it was introduced?

Hopefully I can get pointed in the right direction as the docs have totally baffled me and don't explain how the extension file is created (to me at least).


TOPICS
Development

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 04, 2014 Feb 04, 2014

Copy link to clipboard

Copied

LATEST

Extensions require both native code and ActionScript code and are packed by the native extension compiler by Adobe to an ANE file. Check this tutorial: http://www.adobe.com/devnet/air/articles/building-ane-ios-android-pt1.html

After compiling the extension, you can put the extensionId into your <extensions> branch in the application.xml and add the .ane as an excluded library into your AS3 project. Then you can use the extension like any other external library (swc file).

It's also helpful to download and play around with extisting ANEs. There are some nice open source libraries here: https://github.com/freshplanet

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines