I have a piece of code, that when placed onto a symbol will make it "bounce" out with an elastic effect: onClipEvent (enterFrame) { elastic effect } .
That's all fine and dandy until I come to the problem of getting the elastic protrusion of the symbol to "retract" after a certain trigger in my movie. I was wondering if there is some kind of AS that can set a timer and/or set a trigger for a frame name/number without having to add a keyframe to trigger the retraction. Is this possible? Here is my code:
code:
onClipEvent (load) {
this.elasticScale = function(tar, accel, convert) {
xScale = xScale * accel + (tar - this._xscale) * convert;
yScale = yScale * accel + (tar - this._yscale) * convert;
this._xscale += xScale;
this._yscale += yScale;
}
}
onClipEvent(enterFrame){
this.elasticScale(220,0.5,0.3)
}
Additionally, here is some other code that actually does what I need for a button symbol when you rollout. However, I can't rely on mouse interaction to trigger the retraction:
code:
onClipEvent (load) {
this.elasticScale = function(tar, accel, convert) {
xScale = xScale * accel + (tar - this._xscale) * convert;
yScale = yScale * accel + (tar - this._yscale) * convert;
this._xscale += xScale;
this._yscale += yScale;
}
}
onClipEvent(enterFrame){
if(this.hitTest(_root._xmouse,_root._ymouse,true)){
this.elasticScale(125,0.7,0.4)
}else if (!this.hitTest(_root._xmouse,_root._ymouse,true)){
this.elasticScale(100,0.7,0.4)
}
}
Notice it goes to 125% the actual size on this.hitTest and retracts back to 100% on rollout...
Any help is appreciated!
[This message has been edited by Thumper (edited 03-11-2004).]