Atlasts
06-19-2002, 08:17 PM
Hi,
I'm trying to move a ball in my component 5 pixels to the left when the mouse is pressed (that works) but I would like the ball to keep moving 5 pixels if the user keeps the button pressed. It trying to use the setInterval but the ball will not keep moving. Snipplet:
// On Press Code
this.slideLeft_mc.onPress = function()
{
this._parent.ballObject_mc._x = this._parent.ballObject_mc._x - 5; // this works!!
if (leftLooping != "YES") {
leftLooping = "YES";
leftIntervalSet = setInterval(startLeftMove,50);
}
}
// Interval Function (trace keeps printing intervals but ball does not keep moving!
function startLeftMove ()
{
trace("Left = "+b1);
this._parent.ballObject_mc._x = this._parent.ballObject_mc._x - 5;
count = count + 1;
trace("ball = " +b1.ballObject_mc + " " + count);
updateAfterEvent();
}
Thanks for any help! If there is a better way, let me know.
I've also attached the fla if you want to execute the code.
Thanks,
Atlasts
I'm trying to move a ball in my component 5 pixels to the left when the mouse is pressed (that works) but I would like the ball to keep moving 5 pixels if the user keeps the button pressed. It trying to use the setInterval but the ball will not keep moving. Snipplet:
// On Press Code
this.slideLeft_mc.onPress = function()
{
this._parent.ballObject_mc._x = this._parent.ballObject_mc._x - 5; // this works!!
if (leftLooping != "YES") {
leftLooping = "YES";
leftIntervalSet = setInterval(startLeftMove,50);
}
}
// Interval Function (trace keeps printing intervals but ball does not keep moving!
function startLeftMove ()
{
trace("Left = "+b1);
this._parent.ballObject_mc._x = this._parent.ballObject_mc._x - 5;
count = count + 1;
trace("ball = " +b1.ballObject_mc + " " + count);
updateAfterEvent();
}
Thanks for any help! If there is a better way, let me know.
I've also attached the fla if you want to execute the code.
Thanks,
Atlasts