PDA

View Full Version : bounce script


goodslice
04-26-2004, 05:04 PM
Okay, I am baffled. I use this script all day long in flash 6, but for some reason it doesn't run in 7. Can anyone throw me a bone? I'm pulling my hair trying to get this prototype to work:


MovieClip.prototype.bounce = function(yMax) {
this.onEnterFrame = function() {
yDiff = yMax-this._y;
x *= .5+(yDiff)*.3;
this._y += x;
};
};

simonboris
04-27-2004, 11:42 AM
In flash mx 2004, if you choose to use ActionScript 2, then 'MovieClip.prototype' won't work. It does'nt exist anymore.

You will have to use class, register class etc... to replace the prototype function you have.

goodslice
04-27-2004, 02:56 PM
I'm totally confused then. I have three other prototypes in the same file that work perfectly. In fact, if I take out the *= in this prototype, it works. If I were to write something similar using classes, how would I go about doing that? :confused:

holstead
04-27-2004, 03:11 PM
prototypes in actionscript 1 reflect inheritance. You have to read up on extending classes. Its not very different from prototyping.