Problems with elastic samples from Kirupa website

Hi

I’ve looked at the elastic FLA examples on this website.
They were brilliant and I understood everything!
But… when I tried doing it myself… it didn’t work. :frowning:

I cut and pasted the code straight from the examples, but it still doesn’t work.
I’m using Flash MX 2004. I’ve tried the extra bit to add ‘this’ to make it work on MX 2004, but still no results.

I’ve got the FLA in the following location:

http://filmcharts.com/kirupa/elasticKirupa.fla

Any help would be appreciated.

Thanks.

OM

you have to define xp and yp


MovieClip.prototype.move = function (centerx, centery, inertia, k) 
{ 
	xp = 0;
	yp = 0;
	x = -this._x+centerx;
	y = -this._y+centery;
	xp = xp*inertia+x*k;
	yp = yp*inertia+y*k;
	_x += xp;_y += yp;
}

em… well when i put ‘xp = 0’ and ‘yp = 0’ in, it partially works - but i get no elastic bounce?

AND… in the original code, it doesn’t have these initialisations??

the original code is given below:

http://filmcharts.com/kirupa/elastic.fla
http://filmcharts.com/kirupa/elastic.MX.fla

still confused. :frowning:

has anyone else noticed the sudden spurt of problems in the tutorials code that wasn’t noticed before?

you have to define all variables before using them in Flash MX2004, i’m running out now, but when i get home if noone answer’s you, i’ll fix it.

well… as i said… if i initialise the variables… it kinda works… but i don’t get the elasticity.

AND the MX example from this website works without the defining:

http://www.kirupa.com/developer/actionscript/code/physics.zip

look forward to any replies. thanks.