Groups | Blog | Home
all groups > flash actionscript > november 2006 >

flash actionscript : Get scrolling to stop?


Brenton07
11/18/2006 7:52:38 PM
Ok, I've been working on scrolling lately. I've got the scrolling code down,
but I need one more step. I would like this panel to stop scrolling if I leave
the panel. The setup is that this is in a movieclip named ClipPaneContainer
that is in the bottom right corner of the stage. It contains a movieclip with
instance name panel that contains thumbnails that are buttons inside, and a
movieclip with instance name stroke that are the stroke of the mask layer I
applied and used as a boundary guide. I know it's some math in there that is
messed up, so please help!


////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////

panel.onRollOver = panelOver;

function panelOver() {
this.onEnterFrame = scrollPanel;
delete this.onRollOver;
}

var b = stroke.getBounds; //b as in bounds, target determines boundary
location



function scrollPanel() {
if(_xmouse<b.xMin || _xmouse>b.xMax ||_ymouse<b.yMin || _ymouse<b.yMax) {
//checks if in bounds
this.onRollOver = panelOver;
delete this.onEnterFrame;
}

if(panel._x >= 850) {
panel._x = 850;
}
if(panel._x <= -360) {
panel._x = -360;
}


var xdist = _xmouse; //(stage._x/2) tells where the halfway point is, left
center (-), right center (+)

panel._x += -xdist / 15; //determines speed, bigger is faster, smaller is
slower


}
kglad
11/19/2006 4:09:51 PM
try:



panel.onRollOver = panelOver;
function panelOver() {
panel.onEnterFrame = scrollPanel;
}
panel.onRollOut = panel.onDragOut=function () {
delete panel.onEnterFrame;
};
function scrollPanel() {
trace("HI");
if (panel._x>=850) {
panel._x = 850;
}
if (panel._x<=-360) {
panel._x = -360;
}
var xdist = _xmouse;
//(stage._x/2) tells where the halfway point is, left center (-), right
center (+)
panel._x += -xdist/15;
//determines speed, bigger is faster, smaller is slower
}
AddThis Social Bookmark Button