I couldn't drag either window...

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Michael
Sent: Saturday, September 13, 2008 12:58 PM
To: [email protected]
Subject: [flexcoders] AIR NativeWindow Event.preventDefault() unexpected 
behavior


I'm attempting to intercept the NativeWindowBoundsEvent dispatched
whenever a NativeWindow is dragged in AIR, and am running into a bit
of a problem. If I add an Event listener for
NativeWindowBoundsEvent.MOVING to the initial application nativeWindow
and call preventDefault(), the window behaves as expected and does not
allow itself to be dragged.

If instead I create a new NativeWindow and apply the event listener to
that, the event fires as normal however preventDefault() has no effect.

Now, I've tried adjusting the event listener parameters to give the
listener a higher priority, however even then it's not working. Has
anyone else run into this, and if so, what's the solution?

Michael

===========================================

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
<mx:Script>
<![CDATA[
override protected function initializationComplete():void
{
super.initializationComplete();

// Try it with the application window
this.nativeWindow.addEventListener(
NativeWindowBoundsEvent.MOVING, movingEventHandler );

// Try it with the test window
var testWindow : NativeWindow = new NativeWindow ( new
NativeWindowInitOptions() );
testWindow.addEventListener( NativeWindowBoundsEvent.MOVING,
movingEventHandler );
testWindow.activate();
testWindow.x = 100;
testWindow.y = 100;

}

private function movingEventHandler ( event :
NativeWindowBoundsEvent ) : void
{
event.preventDefault();
event.stopPropagation();
}

]]>
</mx:Script>
</mx:WindowedApplication>

Reply via email to