[kml_flashembed publishmethod=”dynamic” fversion=”9.0.0″ movie=”https://circlecube.com/circlecube/wp-content/uploads/sites/10/2007/04/dynamicscrollingbuttons.swf” width=”550″ height=”400″ targetclass=”flashmovie”]
[/kml_flashembed]
Here’s an example. A dynamic scroll, that changes speed according to your mouse. Here is the code for it as well, I tried to keep it pretty generic, just put this onto a movie clip I named “scroll.” And change the variables to fit your needs. Enjoy, and let me know what you make with it.
Actionscript (as2)
[cc lang=”actionscript” tab_size=”2″ lines=”40″]
onClipEvent(load) {
//variables
scrollMovieClipW = this._width – Stage.width;
leftScrollMargin = 175;
rightScrollMargin = 275;
verticalScrollMargin = 250;
//Note: The lower acceleration value the faster the scroll will be.
acceleration = 3;
}
onClipEvent (enterFrame) {
//to move left
//if mouse is right of 0 (left edge)
if (_root._xmouse >= 0 &&
//if mouse is left of left scroll margin
_root._xmouse <= leftScrollMargin &&
//if mouse is vertically below green line (over the scroll movie clip)
_root._ymouse >= verticalScrollMargin &&
//if the scroll movie clip can still scroll further
_root.scroll._x <= 0) {
this._x -= (_root._xmouse - leftScrollMargin) / acceleration;
}//to move right
else if (_root._xmouse >= rightScrollMargin &&
_root._xmouse <= Stage.width &&
_root._ymouse >= verticalScrollMargin &&
_root.scroll._x >= -scrollMovieClipW) {
//move right
this._x -= (_root._xmouse – rightScrollMargin) / acceleration;
}
}
[/cc]
Source
Download the example file: dynamicScrollingButtons.fla