アプリの構築に mxml を使用するのは初めてです。
基本的に、TileGroup を使用してタイル (6 つ) のリストを作成しています。縦画面で初期化すると見栄えがよくなります (1 行目に 3 つ、2 行目に 3 つ)。
ただし、向きを変更すると、新しい幅と高さに基づいてタイルを再描画する必要があります。
スタック オーバーフローから、サイズ変更イベントをリッスンできることがわかりました。しかし、TileGroup を再描画する方法がわかりません。
最初は、TileGroup に autoLayout を使用できると考えていました。しかし、それはうまくいきませんでした。解決策を探すのに苦労しています (適切なキーワードを使用していなかった可能性があります)。
再描画するために呼び出すことができる関数はありますか?
または、タイルを向きに反応させる別の方法はありますか?
これが私のコードです:
<components:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" xmlns:components="spark.components.*"
title="Forex Calculator">
<components:states>
<s:State name="portrait"/>
<s:State name="landscape"/>
</components:states>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:TileGroup id="mainGroup" includeIn="portrait, landscape" autoLayout="true">
<s:Rect width="75" height="75">
<s:fill>
<s:SolidColor color="0xd54f4f"/>
</s:fill>
</s:Rect>
<s:Rect width="75" height="75">
<s:fill>
<s:SolidColor color="0x2f977d"/>
</s:fill>
</s:Rect>
<s:Rect width="75" height="75">
<s:fill>
<s:SolidColor color="0xfffca2"/>
</s:fill>
</s:Rect>
<s:Rect width="75" height="75">
<s:fill>
<s:SolidColor color="0xfffca2"/>
</s:fill>
</s:Rect>
<s:Rect width="75" height="75">
<s:fill>
<s:SolidColor color="0xfffca2"/>
</s:fill>
</s:Rect>
</s:TileGroup>
ご意見をお聞かせください!ありがとう!
ジャスティン