FLEX gumbo实例:检测FxTextArea控件滚动条的位置.
你首先需要学会在FLEX BUILDER3中编写,编译gumbo的方法: 这里有教程:http://www.cnblogs.com/xxcainiao/archive/2008/11/24/1339865.html
FLEX gumbo实例--检测FxTextArea控件滚动条的位置.
代码:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/12/09/determining-the-current-scroll-position-on-an-fxtextarea-control-in-flex-gumbo/ -->
<Application name="FxTextArea_scroller_test"
xmlns="http://ns.adobe.com/mxml/2009"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<Script>
<![CDATA[
import mx.components.FxVScrollBar;
private function init():void {
var vsb:FxVScrollBar = textArea.scroller.verticalScrollBar;
var min:Number = vsb.minimum;
var val:Number = vsb.value;
var max:Number = vsb.maximum;
lbl1.text = min.toString();
lbl2.text = val.toString();
lbl3.text = max.toString();
progressBar.setProgress(val, max);
}
]]>
</Script>
<ApplicationControlBar dock="true">
<Form styleName="plain">
<FormItem label="minimum:">
<Label id="lbl1" />
</FormItem>
<FormItem label="value:">
<Label id="lbl2" />
</FormItem>
<FormItem label="maximum:">
<Label id="lbl3" />
</FormItem>
<FormItem>
<ProgressBar id="progressBar"
mode="manual"
label="%1 / %2 (%3%%)" />
</FormItem>
</Form>
</ApplicationControlBar>
<FxTextArea id="textArea"
width="100%"
height="100%"
enterFrame="init();">
<content>
<String source="data/lorem.html" />
</content>
</FxTextArea>
</Application>
<!-- http://blog.flexexamples.com/2008/12/09/determining-the-current-scroll-position-on-an-fxtextarea-control-in-flex-gumbo/ -->
<Application name="FxTextArea_scroller_test"
xmlns="http://ns.adobe.com/mxml/2009"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<Script>
<![CDATA[
import mx.components.FxVScrollBar;
private function init():void {
var vsb:FxVScrollBar = textArea.scroller.verticalScrollBar;
var min:Number = vsb.minimum;
var val:Number = vsb.value;
var max:Number = vsb.maximum;
lbl1.text = min.toString();
lbl2.text = val.toString();
lbl3.text = max.toString();
progressBar.setProgress(val, max);
}
]]>
</Script>
<ApplicationControlBar dock="true">
<Form styleName="plain">
<FormItem label="minimum:">
<Label id="lbl1" />
</FormItem>
<FormItem label="value:">
<Label id="lbl2" />
</FormItem>
<FormItem label="maximum:">
<Label id="lbl3" />
</FormItem>
<FormItem>
<ProgressBar id="progressBar"
mode="manual"
label="%1 / %2 (%3%%)" />
</FormItem>
</Form>
</ApplicationControlBar>
<FxTextArea id="textArea"
width="100%"
height="100%"
enterFrame="init();">
<content>
<String source="data/lorem.html" />
</content>
</FxTextArea>
</Application>