2008-10-23 93 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

相關問題