Googolflex!!
  • Home
  • About
  • Contracting

Recent Posts

  • Sprint’s new “Simply ‘Almost’ Everything®” Plans
  • CSS Changes in Flex 4
  • Dotted Underline LinkButton (Flex)

About The Author : jwd

This is John Dusbabek's tech blog. John is a software engineer and Flex developer in Provo, UT, where he lives with his lovely wife and four sons.

Recent Comments

  • Nikos on Flex: Binding to an Interface
  • Iain Hosking on Apache mod_proxy_balancer: No Protocol handler was valid

Archive for July, 2008

Jul
26

Custom Chrome for Adobe AIR Apps

Posted by: jwd | Comments (4)

Every time I’ve seen one of those “branded” AIR applications with the custom window chrome, I’ve thought to myself “That would be kind of cool,” but I didn’t get around to learning how until now.  It’s pretty fun, and is very gratifying for those of you who have a little creative side that likes to come out every now and then.

I start by creating the background image, or custom chrome for my application, along with any other graphical components I’ll need (a close/minimize button, for example). Then you create an AIR application (this assumes Flex Builder).  Normally this will give you a default MXML file with a WindowedApplication tag in it. You need to change it to Application (just like for a web project).

Next you should modify the config file, usually AppName-app.xml Specifically you will need to change the following tags: systemChrome, transparent, visible and give them settings as follows (don’t forget to uncomment them… FlexBuilder doesn’t highlight this file properly for me so I always forget these config settings are commented out by default).

<systemChrome>none</systemChrome>
<transparent>true</transparent>
<visible>true</visible>

If you’re not going to allow the user to resize the application, it is a good idea to set the height and the width to whatever size you need. The systemChrome setting tells AIR you’re going to be supplying the chrome (if you don’t, then Adobe’s generic custom chrome will be used if you have it set to “none”). The transparent setting will allow you to click through parts of your application that are not visible. And the visible setting… well if you don’t know what that means, this tutorial probably isn’t for you.

Next you will need a style for the Application to this effect:

Application {
background-color: "";
background-image: "";
padding: 0px;
}

This clears everything out, so to speak. Then you add your chrome image to the Application tag, and you’re pretty much finished. The problem you will have if you run the application at this point is that you will not be able to move it, close it, etc. There are a few event handlers you will need to add to give the app this functionality.

Adding mouseDown="stage.nativeWindow.startMove() to your background image tag will allow you to grip the application by pressing the mouse anywhere on the image, and drag it around. A few of the more useful ones are:

mouseDown="stage.nativeWindow.startMove()"
---- allows you to move the app
For your window icons:
click="stage.nativeWindow.minimize()"
----allows you to minimize your app
click="stage.nativeWindow.maximize()"
----allows you to maximize the app (if it makes sense to do so)
click="stage.nativeWindow.close()"
----allows you to close the app

There are also ways to resize, but I haven’t gotten into that as much yet. At this point you’re finished. Some things to note: Your application will take up as much room as you give it, though it may not all be visible. This is nice if you want to have slide-out menus and such. Putting the close, etc. icons in weird places may confuse your users, as will changing their basic appearance (square, bar, x).

It’s pretty addictive, but it allows you to create applications that are memorable, I don’t think I’ll be able to go back to normal system chrome for a while.

Categories : AIR, Actionscript, Design, Flex 3
Comments (4)

Search

Feedburner

Subscribe to

Get the latest updates delivered via email

Calendar

July 2008
M T W T F S S
« Jun   Aug »
 123456
78910111213
14151617181920
21222324252627
28293031  

Archives

  • July 2010 (1)
  • June 2010 (2)
  • May 2010 (1)
  • February 2010 (11)
  • January 2010 (3)
  • December 2009 (5)
  • November 2009 (1)
  • August 2009 (8)
  • July 2009 (8)
  • May 2009 (4)
  • April 2009 (1)
  • March 2009 (6)
  • January 2009 (1)
  • November 2008 (4)
  • October 2008 (5)
  • September 2008 (1)
  • August 2008 (5)
  • July 2008 (1)
  • June 2008 (2)
  • May 2008 (8)
  • April 2008 (5)
  • March 2008 (2)
  • February 2008 (3)
  • January 2008 (1)
  • December 2007 (6)
  • November 2007 (9)
  • October 2007 (1)
  • September 2007 (2)

Categories

Tag Cloud

adobe apache Architecture book review C++ centos client server architecture Custom Components database Design error message fedora flash catalyst flex Flex 3 Flex 4 fms iis 6 Interaction Design load balancing master-master master-slave mod_proxy_balancer Monkey Patching MySQL no protocol p2p peer to peer Perl PHP Red5 regex replication self registration selinux Shell Scripting shortcut manager skins socket policy file sockets states stored procedures stratus tools workflow

Coworkers

  • Casey Jackman
  • Sean Murphy

Family

  • Emily & CJ
  • Family Blog
  • Gary Dusbabek

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

RSS FlexExamples

  • Styling the text selection format on a Spark TextArea control in Flex 4
  • Setting the scale mode on a Spark Image control in Flex Hero
  • Setting the fill mode on a Spark Image control in Flex Hero
  • Setting a bitmap image fill on a Spark Form container in Flex Hero
  • Setting a bitmap image fill on a Spark FormHeading control in Flex Hero

Spam Blocked

847 spam comments
blocked by
Akismet

Sponsored Links

JUICE Chat

BYU Adobe Users Group


Copyright © 2010 All Rights Reserved
Flexx Theme by iThemes
Powered by WordPress