AS3 ScrollerPane custom class
Posted by stephen on October 2nd, 2008To use this class you’ll need the “com” folder in the same folder as your .fla, and the createScrollerPane() function.
- Download the example: com.esiteful.display.ScrollerPane
import com.esiteful.display.ScrollerPane;
function createScrollerPane(paneTarget){
stage.frameRate = 31; // for smoother scrolling
var myScrollerPane:ScrollerPane=new ScrollerPane();
myScrollerPane.target=paneTarget;
myScrollerPane.maskArea=new Rectangle(0, 0, 300, 200);
myScrollerPane.scrollSpeed=4;
myScrollerPane.scrollSpeedMax=80;
myScrollerPane.btnScrollUp=btn_up;
myScrollerPane.btnScrollDown=btn_down;
myScrollerPane.btnScrollLeft=btn_left;
myScrollerPane.btnScrollRight=btn_right;
myScrollerPane.start();
}
Pass the instance name of the object you want to scroll to createScrollerPane(). For example:
createScrollerPane(mc_slide_content);
I’m not sure if it needs to be modified to work with constantly changing the scroll target. It may act funky, or get really slow.
Remember that context is important too, so if you’re adding all of this code to the actions frame on the root timeline, your function call will look more like this:
createScrollerPane(mc_accordian.mc_slide1.mc_slide_content);
I will keep this post updated as the ScrollerPane class changes.
Recent Comments