【发布时间】:2009-11-06 10:43:38
【问题描述】:
我已经创建了一个水平滚动条,现在我陷入了如何计算滚动条处于某个位置时内容的位置的问题。
private function checkDrag(event:Event):void {
var procent:Number = (stage.stageWidth/(buttonLR.x+buttonLR.width))*(LISTmc.width)
if (drag) {
TweenLite.to(LISTmc,1,{x:-procent});
}
//buttonLR width is also stretched according to how many data loads in,
thats why I'm trying to target the center of buttonLR
}
每次单击按钮时都会从左到右添加新内容,因此滚动条从左到右滚动后将移动到栏的右端,并显示最新内容。所以如果我想回到之前的内容,我必须把滚动条拖到左边。
目前我的代码在加载新内容并单击滚动条后,内容将移动到舞台左侧的末尾(内容 x=0 的右角),拖动它会使内容向左移动更多。
【问题讨论】:
标签: actionscript-3 scroll