[Solved it myself again, sorry!] Multivartween Problems: "Error: The Object does not have the property..."


(Helios) #1

For those who find this via search: MultiVarTweens can’t access private variables – they are little entities of their own and live their own lives, even if you call them from within another entity. I had to change my “Impulse” variables to public in order for this to work

This doesn’t make any sense to me… the object very clearly DOES have the property and access to it!

Check it out:

	public function addImpulse(x:Number = 0, y:Number = 0, z:Number = 0):void
	{
		impulseX += x;  //
		impulseY += y;  //  these are all private 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 is where the error occurs
	}

when this is called, I get this error:

[Fault] exception, information=Error: The Object does not have the property"impulseZ", or it is not accessible.

(Justin Wolf) #2

Try making your impulse variables public instead of private.

edit: Just noticed you solved it as soon as I posted, haha! Good stuff!


(Helios) #3

Yeah, I had just come to that conclusion and was editing the post when you replied.

Thanks mate, cheers!

I feel bad. I sit around staring at this for like half an hour and then when I finally decide to ask for help, I think of the answer…