This AIR application demonstrates how to download, pause and resume downloads of larger files(mp3, flv, etc) and save to the user’s computer. Big Thanks to Benjamin Dobler for his blog post Resumable Downloads with AIR.
Adobe AIR applications can detect if user is actively using a computer. The NativeApplication object dispatches two events:
userIdle event – user is not using a computer,
userPresent event – user is using a computer again.
The following lines of code set the idle threshold to 20 seconds and listen for both the userIdle and userPresent events:
Sometimes you need a way to create popup window from your application(WindowedApplication). In that case you could use code from my last post Center AIR Window on the screen. This code works just fine for windows(WindowedApplication and Window) running on the main screen. It wouldn’t work correctly in a case where main application(WindowedApplication) is running NOT on the main screen but on the second, third etc monitor. Below picture shows you just that, WindowedApplication is running on the second screen and popup window is center vertically and horizontally above it.
You might have noticed that Window or WindowedApplication doesn’t load in the center of your screen. By default, window loads somewhere in the left side on your desktop. I personally think, that this is a bad user experience and you should always center window vertically and horizontally on screen. You can do this by setting window x coordinate to (screen.width – window.width)/2 and y coordinate to (screen.height – window.height)/2.
In order to drag files from an AIR application, you will need to use the NativeDragManager class. The NativeDragManager class coordinates drag-and-drop operations between an AIR application and the native operating system, between two applications, or between components within a single application.