Flex 4 でクロムレス ウィンドウ アプリケーションを実装しました。ウィンドウをドラッグする機能が必要です。私は多くのグーグルを行ってきましたが、何も思いつきませんでした。誰かが私を正しい方向に向けることができますか.
前もって感謝します。
Flex 4 でクロムレス ウィンドウ アプリケーションを実装しました。ウィンドウをドラッグする機能が必要です。私は多くのグーグルを行ってきましたが、何も思いつきませんでした。誰かが私を正しい方向に向けることができますか.
前もって感謝します。
WindowedApplication のカスタム スキンを作成する必要があります。WindowedApplication のコードを見ると、次のことがわかります。
[SkinPart (required="false")]
public var titleBar:TitleBar;
つまり、スキンに TitleBar を追加できますが、必須ではありません。実際のところ、デフォルトのWindowedApplicationSkinには titleBar がありません。
カスタム スキンにTitleBarを含めると、目的のドラッグ動作が自動的に得られます。デフォルトのTitleBarSkinには通常のウィンドウ ボタン (最小化、最大化、閉じる) が付属しているため、ここでもカスタム スキンを作成することができます。ボタンが必要ない場合は、ボタンなしのものをお勧めします。
これは簡略化された例です。
WindowedApplication のカスタム スキン (白い背景と TitleBar のみ):
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" >
<fx:Metadata>[HostComponent("Object")]</fx:Metadata>
<s:states>
<s:State name="normal" />
<s:State name="disabled" />
<s:State name="normalAndInactive" />
<s:State name="disabledAndInactive" />
</s:states>
<s:Rect id="backgroundRect" left="0" right="0" top="0" bottom="0" >
<s:fill>
<s:SolidColor id="backgroundFill" color="0xffffff" />
</s:fill>
</s:Rect>
<s:TitleBar left="0" right="0" top="0" height="24"
skinClass="skin.TitleBarSkin" />
<s:Group id="contentGroup" left="0" right="0" top="25" bottom="0" />
</s:Skin>
TitleBar のカスタム スキン (グラデーションの背景と閉じるボタンのみ):
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
minHeight="24" >
<fx:Metadata>
[HostComponent("spark.components.windowClasses.TitleBar")]
</fx:Metadata>
<s:states>
<s:State name="normal" />
<s:State name="disabled" />
<s:State name="normalAndMaximized" />
<s:State name="disabledAndMaximized" />
</s:states>
<s:Rect id="background" left="0" right="0" top="0" bottom="0">
<s:fill>
<s:LinearGradient rotation="90">
<s:GradientEntry color="0xFFFFFF" />
<s:GradientEntry color="0xBABABA" />
</s:LinearGradient>
</s:fill>
</s:Rect>
<s:Button id="closeButton" label="close" right="0" verticalCenter="0" />
</s:Skin>
どうやら「closeButton」が必要なので、それをスキンに含める必要があります。それでも削除したい場合は、'visible' および 'includeInLayout' プロパティを 'false' に設定してください。