I have a scrolling picture bar that is masked on the stage. the problem is that the picutre bar does not stay on the stage and loop.
I have a movie clip in the _root. it is 1520 pixel, double the size of the movie width which is 760.
This is the code on that mc....
onClipEvent(load) {
nScreenWidth = 450;
nMaxRate = 15;
// nPixels determines the speed of the slider movement
function moveLeft(nPixels) {
this._x -= nPixels;
if (this._x < 0-nScreenWidth) {
this._x = 0;
}
}
function moveRight(nPixels) {
this._x += nPixels;
if (this._x > 0) {
this._x = 0-nScreenWidth;
}
}
}
onClipEvent(enterFrame) {
// move slider with speed dependent on mouse position
if (_root._xmouse < nScreenWidth/2 && _root._xmouse > 0) {
moveRight(nMaxRate - _root._xmouse * nMaxRate/(nScreenWidth/2));
} else {
if (_root._xmouse > nScreenWidth/2 && _root._xmouse < nScreenWidth) {
moveLeft(_root._xmouse * nMaxRate/(nScreenWidth/2) - nMaxRate);
}
}
}
I have a movie clip in the _root. it is 1520 pixel, double the size of the movie width which is 760.
This is the code on that mc....
onClipEvent(load) {
nScreenWidth = 450;
nMaxRate = 15;
// nPixels determines the speed of the slider movement
function moveLeft(nPixels) {
this._x -= nPixels;
if (this._x < 0-nScreenWidth) {
this._x = 0;
}
}
function moveRight(nPixels) {
this._x += nPixels;
if (this._x > 0) {
this._x = 0-nScreenWidth;
}
}
}
onClipEvent(enterFrame) {
// move slider with speed dependent on mouse position
if (_root._xmouse < nScreenWidth/2 && _root._xmouse > 0) {
moveRight(nMaxRate - _root._xmouse * nMaxRate/(nScreenWidth/2));
} else {
if (_root._xmouse > nScreenWidth/2 && _root._xmouse < nScreenWidth) {
moveLeft(_root._xmouse * nMaxRate/(nScreenWidth/2) - nMaxRate);
}
}
}