2

私の Flex3 アプリには、さまざまな量のテキストを含むフローティング ウィンドウがいくつかあります。ウィンドウは、ユーザーがサイズ変更できるようになっています。現在、ウィンドウのサイズを変更することはできますが、ウィンドウのサイズが変更されたときに、ウィンドウ内の TextArea 内のテキストをリフローすることはできません。TextArea にサイズのバグがあり、テキスト コンテンツを設定しても TextArea のサイズが適切に変更されないというブログ投稿に出くわしました。私の場合、コンテンツは同じままですが、コンテナーのジオメトリが変更されます。起こっているように見えるのは、TextArea が最初にレンダリングされるときに固定サイズを採用し、コンテナーのサイズを変更してもそれが変わらないことです。Flex で可変テキスト領域を作成する方法を提案できる人はいますか?

イアン

4

4 に答える 4

0

textArea の幅をコンテナーの幅にバインドすることで、余白と境界線を維持でき、パーセンテージを処理する必要がなくなります。
また、親のサイズが変更されるたびに、 textArea のサイズが変更されます。
私はこのようなことを考えています:

<fx:Script>
    <![CDATA[
        import spark.layouts.supportClasses.LayoutBase;

        protected function onButtonClicked(event:MouseEvent):void
        {
            currentState = (event.target.selected ? 'largeState' : 'smallState');
        }

    ]]>
</fx:Script>
<s:TitleWindow id="window" width="300" height="200">
    <s:TextArea width="{window.width - 10}" height="{window.height - 60}" 
        text="{IMyConsts.LOREMIPSUM}" borderVisible="false" />
    <s:ToggleButton id="btnEffect" bottom="5"  click="onButtonClicked(event)"
        label="{btnEffect.selected ? 'Go smaller' : 'Go larger'}" />
</s:TitleWindow>
<s:states>
    <s:State name="smallState" />
    <s:State name="largeState" />
</s:states>
<s:transitions>
    <s:Transition fromState="smallState" toState="*">
        <s:Resize target="{window}" widthTo="400" heightTo="300" />
    </s:Transition>
    <s:Transition fromState="largeState" toState="*">
        <s:Resize target="{window}" widthTo="300" heightTo="250" />
    </s:Transition>
</s:transitions>
于 2011-04-11T10:15:58.857 に答える
0

Adobe の Text Layout Framework を試すことができます: http://labs.adobe.com/technologies/textlayout/

于 2009-06-16T21:40:13.467 に答える
0

I can take a whack at this... but don't laugh.. I am not sure if you need to use a particular container but in any event, set the width and height to 100% and use Grid > GridRow and GridItem to size and resize Text Control you can specify the width of the table or just use it just like an HTML table in Flex to manipulate the size of controls and containers....

hope that helps...

于 2010-01-07T00:16:33.670 に答える