前端 · 2012 年 12 月 25 日

[Flex4]经常使用VGroup配合VScrollBar滚动条

使用VGroup配合VScrollBar滚动条,
VScrollBar还可以自定义皮肤。
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:VGroup x="128" y="85" id="myGroup" width="200" height="200" gap="10"  clipAndEnableScrolling="true">
        <s:Button label="x1" />
        <s:Button label="x2" />
        <s:Button label="x3" />
        <s:Button label="x4" />
        <s:Button label="x5" />
        <s:Button label="x6" />
        <s:Button label="x7" />
        <s:Button label="x8" />
        <s:Button label="x9" />
        <s:Button label="x10" />
        <s:Button label="x11" />
        <s:Button label="x12" />
        <s:Button label="x13" />
    </s:VGroup>
    <s:VScrollBar viewport="{myGroup}" height="200"  x="312" y="85" />
</s:Application>