B.5. Chapter 10 Exercise

The goal of this exercise is to assign a different dock or system tray icon when each of four windows is in focus. Listing B-7 contains the mail file for the Chapter 10 exercise. This file declares the four windows that will be used within the application and then includes four Button components to create each window. Listing B-8 shows an example of one of the four windows. The only difference in the other three that is not included in this section is the source for the icon that will be used. Looking further at Listing B-8, you will see that upon creationComplete of the window, an event listener is added, which will fire whenever the window is being interacted with. The init() function also calls the addIcon() function to set when the window is first opened. The event listener previously mentioned will handle the call to addIcon() when the window is interacted with after it is already open. Figures B-6 and B-7 show the icons for Window 2 and Window 4 being displayed in the Mac OS X dock.

Example B-7. The main solution file for the Chapter 10 Exercise
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute">
    <!--
    Create an application that assigns a different icon
    (either dock or system tray) when each window is in focus.
    -->
    <mx:Script>
        <![CDATA[
        import mx.core.Window;
        private var win1:Win1 = new Win1();
        private var win2:Win2 = new Win2();
        private var win3:Win3 = new Win3();
        private var ...

Get Beginning Adobe® AIR™: Building Applications for the Adobe Integrated Runtime now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.