2008-10-23 90 views

回答

2

会是这样的:

this.createClassObject(mx.containers.ScrollPane, "my_sp", 10); 
my_sp.setSize(360, 280); 
this.createEmptyMovieClip("button_up",this.getNextHighestDepth()); 
this.createEmptyMovieClip("button_down",this.getNextHighestDepth()); 
this.createEmptyMovieClip("button_left",this.getNextHighestDepth()); 
this.createEmptyMovieClip("button_right",this.getNextHighestDepth()); 

button_up.onPress=function(){ 
    my_sp.onEnterFrame=function(){ 
      this.vPosition -= 5; 
    } 
} 

button_down.onPress=function(){ 
    my_sp.onEnterFrame=function(){ 
      this.vPosition += 5; 
    } 
} 
button_left.onPress=function(){ 
    my_sp.onEnterFrame=function(){ 
      this.hPosition -= 5; 
    } 
} 

button_right.onPress=function(){ 
    my_sp.onEnterFrame=function(){ 
      this.hPosition += 5; 
    } 
} 

//replace this with whatever event you want to use to make the scrolling stop 
button_right.onRollOut = button_left.onRollOut = button_up.onRollOut = button_down.onRollOut = function(){ 
     my_sp.onEnterFrame=undefined; 
} 

你必须检查_hmax和_vmax,以确保您不会滚过内容,其中滚动条会自然停止在年底。我不记得这些变量的名称是什么,但是如果你在调试模式下运行你的程序并且围绕scrollpane实例进行查询,你应该找到它。如果将内置滚动条移动到底部并查看变量发生了什么变化,然后找到匹配并且是静态的变量,它可能会更容易。

+0

对不起,忘了扔在那里,你需要真的把东西放在那些按钮,所以他们不只是空的电影剪辑,并且实际上可以像按钮一样:) – 2009-01-04 09:56:47

相关问题