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

flash actionscript : Infinate scroller, buttons dont work


kiltster
11/24/2004 9:12:29 PM
I have used this bit of code for a infinate image scroller and it it works well
but now the buttons within the scroller mc don't work!! can any one help?

xcenter = 336;
speed = 5/100;
mc.onRollOver = function(){
mc.onEnterFrame = function(){
trace(mc._x);
var distance = _root._xmouse-xcenter;
mc._x += (distance*speed);
if (mc._x>0) {
mc._x = -800;
}
if (mc._x<-800) {
mc._x = 0;
}
}
}
mc.onRollOut = function(){
delete (mc.onEnterFrame);
NSurveyor
11/24/2004 9:27:27 PM
I believe I gave you that code yesterday. And here is the way to fix it (I
think...):
xcenter = 336;
speed = 5/100;
bounds = mc.getBounds();
onRolledOver = true;
this.onEnterFrame = function(){
if(_xmouse>bounds.xMin and _xmouse<bounds.xMax and _ymouse>bounds.xyin and
_ymouse<bounds.yMax){
if(onRolledOver){
onRolledOver = false;
mc.onEnterFrame = function(){
trace(mc._x);
var distance = _root._xmouse-xcenter;
mc._x += (distance*speed);
if (mc._x>0) {
mc._x = -800;
}
if (mc._x<-800) {
mc._x = 0;
}
}
}
}else{
onRolledOver = true;
delete (mc.onEnterFrame);
}
};
kiltster
11/24/2004 9:32:25 PM
kiltster
11/24/2004 9:37:41 PM
NSurveyor
11/24/2004 9:39:03 PM
Sorry, there's a small mistake...

xcenter = 336;
speed = 5/100;
bounds = mc.getBounds();
onRolledOver = true;
this.onEnterFrame = function() {
if (_xmouse>bounds.xMin and _xmouse<bounds.xMax and _ymouse>bounds.yMin
and _ymouse<bounds.yMax) {
if (onRolledOver) {
onRolledOver = false;
mc.onEnterFrame = function() {
var distance = _root._xmouse-xcenter;
mc._x += (distance*speed);
if (mc._x>0) {
mc._x = -800;
}
if (mc._x<-800) {
mc._x = 0;
}
};
}
} else {
onRolledOver = true;
delete (mc.onEnterFrame);
}
};
kiltster
11/24/2004 9:49:40 PM
NSurveyor
11/24/2004 10:01:31 PM
How 'bout now?:

xcenter = 336;
speed = 5/100;
this.onEnterFrame = function() {
bounds = mc.getBounds(this);
if (_xmouse>bounds.xMin and _xmouse<bounds.xMax and _ymouse>bounds.yMin
and _ymouse<bounds.yMax) {
var distance = _root._xmouse-xcenter;
mc._x += (distance*speed);
if (mc._x>0) {
mc._x = -800;
}
if (mc._x<-800) {
mc._x = 0;
}
}
};
kiltster
11/24/2004 10:11:36 PM
NSurveyor
11/24/2004 10:35:07 PM
AddThis Social Bookmark Button