Topic: Flash Actionscript: Elastic probs Pages that link to <a href="https://ozoneasylum.com/backlink?for=11487" title="Pages that link to Topic: Flash Actionscript: Elastic probs" rel="nofollow" >Topic: Flash Actionscript: Elastic probs\

 
Author Thread
Thumper
Paranoid (IV) Inmate

From: Deeetroit, MI. USA
Insane since: Mar 2002

IP logged posted posted 03-11-2004 19:04 Edit Quote

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).]

Cameron
Bipolar (III) Inmate

From: Brisbane
Insane since: Jan 2003

IP logged posted posted 03-12-2004 18:01 Edit Quote

Dude, you really need to post example swf files with this.

That code is all nice and dandy, but if I can't see what it's doing then it's for naught as I'm not about to run off and cut'n'paste it into flash to try and figure it out. Someone might, but I really don't have to time to do all that just to figure out your question, which isn't terribly clear or obvious without any visible examples to go along with it.

Thumper
Paranoid (IV) Inmate

From: Deeetroit, MI. USA
Insane since: Mar 2002

IP logged posted posted 03-14-2004 00:48 Edit Quote

Basic visual: When something happens {elastic scale} ...When something else happens {elastic scale}

Example

Cameron
Bipolar (III) Inmate

From: Brisbane
Insane since: Jan 2003

IP logged posted posted 03-15-2004 10:20 Edit Quote

[quote]
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.
[quote]

Ok, letting us know how much you know about actionscript would be handy as well.

quote:
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.



Really not sure what you're asking here. If you want to setup some kind of time delayed action (using the word trigger here is confusing as it has multiple meanings depending on the context, which hasn't been defined), you'll probably want to use a setInterval() that will unset itself after it's first called.

In any event, you'll probably want to build that code into some kind of function or method that you can explicitly call from any point in the execution of the movie.

But like I said before, I really don't understand what your're trying to do. If you want something to happen based on the location of the playhead in the timeline, then setting a frame action is the only way you should be doing it. After all what's the point of removing it from the timeline if the action revolves around happening at a particular time throughout the execution of the movie. That's what frame actions are for.

Perhaps you could re-word the question to provide some kind of idea as to what it is you actually want to achive, rather than just describing what you think the solution to the problem is.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu