Flex Gumbo中如何通过textJustify样式设置TextBox文字对齐的例子

By Minidxer | June 9, 2009

接下来的例子演示了Flex Gumbo中如何通过textJustify样式,设置TextBox文字对齐。

编译本例需要Flex Gumbo build 4285 (4.0.0.4285)版本。



下面是实现代码:

Download: main.mxml
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Application name="TextBox_textJustify_test"
  3.         xmlns="http://ns.adobe.com/mxml/2009"
  4.         layout="vertical"
  5.         verticalAlign="top"
  6.         backgroundColor="white">
  7.  
  8.     <ApplicationControlBar dock="true">
  9.         <Form styleName="plain">
  10.             <FormItem label="textJustify:">
  11.                 <ComboBox id="comboBox"
  12.                         dataProvider="[distribute,interWord]" />
  13.             </FormItem>
  14.             <FormItem label="width:">
  15.                 <HSlider id="slider"
  16.                         minimum="300"
  17.                         maximum="550"
  18.                         value="500"
  19.                         snapInterval="1"
  20.                         tickInterval="25"
  21.                         liveDragging="true" />
  22.             </FormItem>
  23.         </Form>
  24.     </ApplicationControlBar>
  25.  
  26.     <Graphic>
  27.         <TextBox id="textBox"
  28.                 textAlign="justify"
  29.                 textJustify="{comboBox.selectedItem}"
  30.                 width="{slider.value}">
  31.             <text><String source="data/lorem.txt" /></text>
  32.         </TextBox>
  33.     </Graphic>
  34.  
  35. </Application>
代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Topics: Gumbo, TextBox | No Comments » | Tags: , ,

Search Posts