...

View Full Version : Flash image scroller - making it auto scroll



Everlongdrummer
04-29-2009, 09:28 AM
I have a small flash image scroller that scrolls a row of buttons horizontally based on the users mouse movement. (half finished version shown at bottom of page at www.bizmagic.com.au/preview/bkind)

Its basically a movie clip contained a row of buttons, with AS applies as follows:


onClipEvent (load) {
// size of one of the Movie Clips
MCsize = 1430.0;
// size of stage
StageSize = 550;
// increase decrease speed.
speed = 5;


function moveLeft(nPixels) {
this._x -= nPixels;
if (this._x<0-MCsize) {
this._x = 0;
}
}
function moveRight(nPixels) {
this._x += nPixels;
if (this._x>0) {
this._x = 0-MCsize;
}
}
}
onClipEvent (enterFrame) {
if (_root._xmouse<StageSize/2 && _root._xmouse>0) {
moveRight(speed-_root._xmouse*speed/(StageSize/2));
} else {
if (_root._xmouse>StageSize/2 && _root._xmouse<StageSize) {
moveLeft(_root._xmouse*speed/(StageSize/2)-speed);
}
}
}

I was just wondering if it was possible to get the slider moving on page load instead of having to wait for user mouse interaction to get it moving!

Appreciate any input, thanks. :)

gnomeontherun
05-04-2009, 10:09 AM
Use an onLoad handler for the movie to trigger the first reaction. Is this all of the code?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum