代码之家  ›  专栏  ›  技术社区  ›  Ian Dickinson

Flex3中文本的流畅布局

  •  2
  • Ian Dickinson  · 技术社区  · 17 年前

    4 回复  |  直到 17 年前
        1
  •  0
  •   Chinmay    17 年前
        2
  •  0
  •   user56250 user56250    16 年前

    您可以从Adobe尝试文本布局框架: http://labs.adobe.com/technologies/textlayout/

        3
  •  0
  •   CraigJSte    16 年前

    我不确定您是否需要使用特定容器,但无论如何,请将宽度和高度设置为100%,并使用Grid>GridRow和GridItem要调整文本控件的大小,您可以指定表的宽度,或者像Flex中的HTML表一样使用它来操作控件和容器的大小。。。。

    希望这有助于。。。

        4
  •  0
  •   rekaszeru    15 年前

    通过将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>