mindfriction
August 14th, 2003, 09:35 AM
Hi guys and girls,
Having a few problems. I give a number of mc's an onEnterFrame event on the fly (in a for loop) which calls an easing function. This function is passed a variable whos value is worked out incrementally, ie on each loop the value is incremented (+=).
I do this because I want each mc to be horizontally offset, in other words each clip eases so they come one after the other. Hope this makes sense, ANYWAY the problem the value of the variable (I mentioned above) which each clip uses to determine the postion it has to ease to seems to constantly reset itself. In other words the clips ease right on top of each other since the variable is reset to the last value it obtained from the last increment!!!. Anyone help!??
trace("yes");
panelAmt = 5;
speed = 4;
tabWidth = 20.5;
for(i=1;i<=panelAmt;i++)
{
this["panel" + i].onEnterFrame = function(leftAlign)
{
//var leftAlign = tabWidth*i;//offsets left alignment
this._x += (temp-this._x)/speed;
trace(speed);
trace(this + " " + leftAlign);
}
leftAlign+=tabWidth;
}
Having a few problems. I give a number of mc's an onEnterFrame event on the fly (in a for loop) which calls an easing function. This function is passed a variable whos value is worked out incrementally, ie on each loop the value is incremented (+=).
I do this because I want each mc to be horizontally offset, in other words each clip eases so they come one after the other. Hope this makes sense, ANYWAY the problem the value of the variable (I mentioned above) which each clip uses to determine the postion it has to ease to seems to constantly reset itself. In other words the clips ease right on top of each other since the variable is reset to the last value it obtained from the last increment!!!. Anyone help!??
trace("yes");
panelAmt = 5;
speed = 4;
tabWidth = 20.5;
for(i=1;i<=panelAmt;i++)
{
this["panel" + i].onEnterFrame = function(leftAlign)
{
//var leftAlign = tabWidth*i;//offsets left alignment
this._x += (temp-this._x)/speed;
trace(speed);
trace(this + " " + leftAlign);
}
leftAlign+=tabWidth;
}