我有问题。我想只通过标题栏/标题制作可拖动的Air TitleWindow应用程序。我有这个代码,但它可以拖到任何地方。你可以帮忙吗?
<?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>
在appliacation xml中,设置为:
<systemChrome>none</systemChrome>
<transparent>false</transparent>
答案 0 :(得分:0)
这是一种解决方案:
<?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>