我有我编程填充VBox中,特定事件(的DragDrop)我做了一些计算后,记录一些变量,然后重新建立垂直框。这一切的伟大工程,但我想要的VBox中,以回到正确verticalScrollPosition的滚动。我想即使是最简单的事情:

myVBox.verticalScrollPosition = 200

但我就是不能让它设置滚动位置它的重建之后。任何想法?

编辑:每永邦的反应,我意识到,我的DragDrop函数被调用重建者函数,则定位器功能背靠背,这意味着它没有这样做在建时,它试图设置。现在,我通过我想要的框设置为给重建者函数设置滚动位置建立垂直框的结束,一切顺利的位置很好。

有帮助吗?

解决方案

尝试添加该代码,我在工作,所以如果它的工作原理我无法验证,希望如此:

//Initialize the Vbox
public var myVbox:VBox = new VBox();
//Define the function which rebuilds the Vbox
public function rebuildVbox():VBox{  
myVbox.verticalScrollPosition=200;
return myVbox
}
//Define your event.complete function which sets the verticalScrollPosition  
//after the drag drop
public function setVerticalScrollPosition():void{
    myVbox.addEventListener(Event.COMPLETE,function(event:Event):void{
            rebuildVbox()
            });
    }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top