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] document.body.onmousedown = function() { window.htmlControl.stage.window.startMove(); } [/javascript]
Pingback: A Modern Fable (AJM) » Blog Archive » Dragging Windows in Adobe AIR
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?
I developed it on Mac, works fine there.
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?
If you are like me and ended up in this site looking for a quick sollution for this, the answer is:
window.nativeWindow.startMove();
Looks like there was a change to the API at some stage.
this works for me:
document.onmousedown = function() { window.nativeWindow.startMove(); }
cheers gavin
Great! window.nativeWindow.startMove(); worked for me as well. Cheers guys…
Air 1.5.1 withing the windowed application…
stage.nativeWindow.startMove();
Fab, thanks! To limit to dragging by a particular handle:
document.getElementById(“someid”).function() {window.nativeWindow.startMove(); }
works a treat
Whoa, 3 years later, they still haven’t made it obvious how to do this?
Well, you know how it is with Adobe documentation: educate people to use products by, er… hiding the documentation!
Nice done! window.nativeWindow.startMove(); worked for me as well. Thanks guys…