Software As She’s Developed

Mahemoff’s Podcast/Blog - Web, Programming, Usabilty from the Author of ‘Ajax Design Patterns’ (AjaxPatterns.org)

Software As She’s Developed header image 2

Drag a custom window with Adobe Air

July 29th, 2007 · 4 Comments

Quick tip. Been playing with Adobe Air recently and was trying to let the user drag a "systemChrome="none" transparent="true" around. The definitive Air reference has an example that shows how to close and minimize, but not how to move it. And all the examples I could find are Flash-based rather than the HTML/JS/Ajax approach I'm taking (along with some forum posters who were as confused as I was). Based on the Flash examples and the close/minimise pattern, it turned out to be this simple:

JAVASCRIPT:
  1. document.body.onmousedown =
  2.         function() { window.htmlControl.stage.window.startMove(); }


Categories: SoftwareDev

Tags:

4 responses so far ↓

  • 1 A Modern Fable (AJM) » Blog Archive » Dragging Windows in Adobe AIR // Aug 11, 2007 at 9:49 pm

    […] Here’s how to do that. […]

  • 2 Khanh // Feb 15, 2008 at 10:11 pm

    Thanks for this, I”ve been searching for this piece of code as well. I”m developing AIR on a mac… is this code specific to windows?

  • 3 mahemoff // Feb 21, 2008 at 4:56 pm

    I developed it on Mac, works fine there.

  • 4 andy matthews // Mar 12, 2008 at 1:22 am

    Care to provide a little more detail? I’m trying this snippet and I’m getting nothing. The container I’d like to be used as the draggable area is called titlebar. Would the resulting code be:

    document.titlebar.onmousedown =
    function() { window.htmlControl.stage.window.startMove(); }

    or am I missing something? Also, where are you placing this line?

Leave a Comment