ScrollPaneにactionscriptを使用して上下にスクロールするように指示するにはどうすればよいですか?

StackOverflow https://stackoverflow.com/questions/230885

  •  04-07-2019
  •  | 
  •  

質問

ScrollPaneが上下にスクロールを開始するイベントをトリガーしたい。

理想的には、ScrollPaneは、別のイベントによってキャンセルされない限り、スクロールを続けて上下にスクロールします。

役に立ちましたか?

解決

次のようになります:

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をチェックして、スクロールバーが自然に停止するコンテンツの終わりを超えてスクロールしないことを確認する必要があります。これらの変数の名前が何であるか覚えていませんが、プログラムをデバッグモードで実行し、スクロールペインインスタンスを突くと、それを見つけるはずです。組み込みのスクロールバーを一番下に移動して、どの変数が変化するかを確認してから、一致する静的な変数を見つけると、おそらく簡単になります。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top