AIR: Making Draggable Windows

Download Example Files

I've recently been working on my first AIR project and one of the things it had to include was dragging around your desktop with a transparent chrome (meaning there is no minimize/close/etc buttons). It is really simple to do in AIR (one line of code to do the actual dragging) so here it is:

  1. box_mc.addEventListener(MouseEvent.MOUSE_DOWN, doMouseDown);
  3. function doMouseDown($evt:MouseEvent):void
  4. {
  5.     this.stage.nativeWindow.startMove();
  6. }

Keep in mind AIR is all AS3 so there is no AS2 alternative for this method. Also make sure to set up your file to output the transparent chrome by going to Commands > AIR Application & Installer Settings (if you've followed my tip on how to set AIR up in Flash CS3) and change the Window style to Custom Chrome (transparent).

If you found this post useful, please consider leaving a comment, subscribing to the feed, or making a small donation.

No Comments

No comments yet.

Leave a comment