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.
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:
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).
Copy link to clipboard
Copied
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