0

I have problem. I'd like to make dragable am Air TitleWindow application only by titlebar/header. I have this code, but its dragable everywhere. Could you help in this?

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   xmlns:mx="library://ns.adobe.com/flex/mx">
<fx:Script>
    <![CDATA[
        import mx.events.CloseEvent;

        private function mainWindow_closeHandler(event:CloseEvent):void
        {
            stage.nativeWindow.close();
        }

        protected function OnDrag(event:MouseEvent):void
        {
            stage.nativeWindow.startMove();
        }

    ]]>
</fx:Script>

<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<s:TitleWindow id="mainWindow" width="100%" height="100%"
               title="Title Window Header"
               mouseDown="OnDrag(event)"
               close="mainWindow_closeHandler(event)">
</s:TitleWindow>
</s:WindowedApplication>

In the appliacation xml the settings are:

<systemChrome>none</systemChrome>
<transparent>false</transparent>
Gabor Kako
  • 198
  • 1
  • 6
  • You should really try to [google](http://help.adobe.com/en_US/flex/using/WS6c678f7b363d5da52e8f1ca1124a0430dcf-8000.html#WS6c678f7b363d5da5-57afda60124a09daf90-8000) before asking a question. Voting to close. – J_A_X Sep 21 '11 at 01:43
  • Or search this site. I've answered this question about 2 weeks ago (http://stackoverflow.com/questions/7270978). So also possible duplicate. – RIAstar Sep 21 '11 at 09:36

1 Answers1

0

This is a kind of solution:

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx">

<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<s:TitleBar height="24" width="100%" x="0" y="0" title="Title"/>

</s:WindowedApplication>
Gabor Kako
  • 198
  • 1
  • 6