I started a previous thread that was just too vague, wasn’t near my comptuer and I thought if I understood the concepts a little better I could work this out. Here is the problem, I am having a hard time understanding how to attach this function to a movieclip in a meaningful way, this is my code. Hopefully someone can shed some light on my errors. All of this code resides in _level0 frame 1.
effect = function(scale) {
currentFrame = 0;
this.onEnterFrame = function() {
this.speedXscale = (this.speedXscale*this.friction)+((scale-this._xscale)*this.ratio);
this.speedYscale = (this.speedYscale*this.friction)+((scale-this._yscale)*this.ratio);
this._xscale += this.speedXscale;
this._yscale += this.speedYscale;
currentFrame++;
if (Math.floor(this._xscale*100) == (scale*100)) {
delete this.onEnterFrame;
}
}
}
... elsewhere ...
//effect code (bounce)
//
this.menu[context+"_"+optionnumber].friction = .8;
this.menu[context+"_"+optionnumber].ratio = .3;
this.menu[context+"_"+optionnumber].speedXscale = 0;
this.menu[context+"_"+optionnumber].speedYscale = 0;
this.menu[context+"_"+optionnumber].optionEffect = new effect();
// option events
this.menu[context+"_"+optionnumber].onRollOver = function() {
optionEffect(200);
}
this.menu[context+"_"+optionnumber].onRollOut = function() {
optionEffect(100);
}
Thanks!