Hey guys, I’ve done the tutorial at Bit-101 on elasticity. Now I’m trying to do elasticit with the width and height when the mouse rolls over it. However, I am having trouble starting out. I have been using xscale and yscale so far, but the only thing I have gotten a square to di is expand width and height in increments, and not in smooth animation. After I know how to do it in animation, I will start trying to add variables to get the elasticity effect. Could someone point me in the right direction with this one?
The same way you do the movement elasticity but instead of X- and Y positions use X- and Y scales!
insead of “_x” use “_xscale” andinstead of “_y” use “_yscale”
It’s as easy as that!
sounds like you’re putting the elasticity code on the button and not on the clip it effects. The button should only effect the ‘target’ scale and the actual elasticity should be run off an enterFrame event through the movieclip its being used on.
I have an example here that uses both movement (with click) and scale (with hitTest)
in terms of buttons (that example doesnt use them) all you would have to do is change the targt property of the movieclip using the button and make sure the elastic code in in the enterFrame of the movieclip with targt used as the targt scale.
Thanks to both of you for your help. Senocular, that .fla was an AWESOME help! I took the code and copied it into Notepad, and then sat down with my Actionscript reference for a long time and went over each bit of code, to make sure I could fully understand and replicate the elasticity effect. (I don’t like just mindlessly copying code and pasting it) LOL I have a full page of notes! I have never used the prototype method before, and it sure is a lot easier than what I was planning on doing, especially combined with the hitTest. I am going to try to incorporate more of this type of code into future works.