Flex的Scroller组件指定滚动位置

求大神 们 ,帮帮忙

protected function init(event:FlexEvent):void
{
for(var i:int = 0;i < 100; i++)
{
var ahl:AutoWidthLoader = new AutoWidthLoader();
ahl.source = Instance;
ahl.percentHeight = 100;
(ahl.content as Instance).mc1_1.gotoAndStop(1);
(ahl.content as Instance).mc1_2.gotoAndStop(1);
(ahl.content as Instance).mc1_3.gotoAndStop(1);
(ahl.content as Instance).mcId1_1.gotoAndStop(1);
(ahl.content as Instance).mcId1_2.gotoAndStop(1);
(ahl.content as Instance).t1.text = (i+1).toString();
list.addElement(ahl);
}


trace(sr.maxWidth);
list.horizontalScrollPosition = 10/100*list.maxWidth;

}

]]>
</fx:Script>
<fxeclarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fxeclarations>
<common:AutoHeightLoader id="View" width="100%" source="{scene}"/>
<s:Scroller id="sr" top="37" y="20" width="100%" height="22%" horizontalCenter="0" interactionMode="touch" horizontalScrollPolicy="auto">
<s:HGroup id="list" x="10" height="100%" gap="0">
</s:HGroup>
</s:Scroller>

我在list里边添加了100个mc,想在开始的时候让滚动条停在第十个mc的位置,请问要怎么实现呢
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值