Daniel Dura

All About the Adobe Flash Platform

Archive for March, 2007

Apollo Multi-Window Support using Flex

with 12 comments

One of the most exciting features of Apollo is support for applications which have multiple native windows. Currently when using Flex in the browser, you are limited to using PopUpManager or rolling your own MDI architecture. With Apollo, your application can look more like, well… a native application. Each window will appear in the task bar on Windows, have a tab and z-order, etc.

An existing issue in the Apollo alpha that you may struggle with if you are doing Flex development, is that the Flex Framework does not currently support Apollo’s NativeWindow implementation. The issue stems from the fact that now your Apollo application can have multiple stages and the Flex framework which was originally developed for the browser player doesn’t take this into consideration. Right now if you try to add Flex content, such as a custom Flex component, to a new windows stage you will get unexpected and broken behavior.

Now, I wouldn’t bring this up unless I had a solution. But before I show you that, a few caveats: a future release of the Flex Framework will formally support multiple windows. If you are looking at this article and there is currently a post-alpha Apollo release, please check the docs first to see if Flex officially supports multiple native windows. Another caveat: You will still run into a few issues and bugs when using this technique. For example, PopUpManager may not work properly in new NativeWindow instances.

On to the code (the comments should explain what is going on):

Read the rest of this entry »

Written by Daniel Dura

March 30th, 2007 at 8:01 am

Posted in AIR,Flex,Tutorial

Apollo Native File Dialogs

with 6 comments

Currently the Apollo Alpha doesn’t support native file dialog boxes (it will before the final official release.) Despite that, there is a way to get this functionality now by using existing Flash Player APIs.

I will first show how to display a file ‘Save’ dialog box which allows the user to specify the name of the file they would like to write to the disk. This will allow them to type in the name of a file that may not exist. The user can also select a file that already exists and the dialog will prompt the user that they are about to replace that file on the system.

To accomplish this in Apollo, you use the ‘download’ method on the flash.net.FileReference class. Because the flash.filesystem.File class extends FileReference, you can employ this technique by using that class as well. The trick to getting the File reference without actually downloading the file is to cancel the URLRequest before it executes. See the code below for an example:
Read the rest of this entry »

Written by Daniel Dura

March 29th, 2007 at 6:24 am