[Fixed but not solved] MultiVarTween doesn't seem to be altering my values


(Helios) #1

I think the problem has something to do with the fact that I called “addImpulse” in the constructor for my World class. This is a bizarre bug. I changed it to add an impulse when a key was pressed, and it seems to be working fine.

I just want impulseX to be tweened back down to zero as soon as I call this function.

public function addImpulse(x:Number = 0, y:Number = 0, z:Number = 0):void
{
	impulseX += x;  //
	impulseY += y;  //  these are all public variables of this class
	impulseZ += z;  //
	if (impulseEnd) FP.world.addTween(impulseTween)
	impulseEnd = false; 

	impulseTween.tween(this, { impulseX:0, impulseY:0, impulseZ:0 },
               dragTime, dragFunction);  //this should tween these values, right?
}

I call

thing.addImpulse(10, 0, 0);

and then in my update function…

	override public function update():void 
	{
		trace(impulseX);
	}

and what do I get in my output pannel?

10 10 10 10 10 10 10

aaaaaagh!


(azrafe7) #2

If that fixes it then you can try to override added() and call the function from there.