PDA

View Full Version : [howto] elastic image...action



sWo0p
November 7th, 2002, 07:26 AM
Hi im working on en site that needs a bouncie image, but all the tuts and movie clip i can find only work with onmouseover effect.. i dont want onmouseover but bounce when the clip loads....

maybe someone can rearange this script so it bouces on clipload...


this in the 1st frame:

Movieclip.prototype.elasticScale = function(target, accel, convert) {
xScale = xScale * accel + (target - this._xscale) * convert
yScale = yScale * accel + (target - this._yscale) * convert
this._xscale += xScale
this._yscale += yScale
}

and this in the movie clip:

onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
elasticScale(150, 0.9, 0.1)
} else {
elasticScale(100, 0.9, 0.1)
}
}

please can someone help?

lostinbeta
November 7th, 2002, 01:12 PM
Can't you just do........


onClipEvent (enterFrame) {
elasticScale(150, 0.9, 0.1);
}

???

sWo0p
November 7th, 2002, 02:19 PM
okay i tryed your idea and must laugh :)
i always seem to have the bigest codes....

dhamm you juist made my code 2 times smaller :)

butt okay back to the code.. you solution does work but did'nt give me the effect that i was going for...

i need to give in a minimu point of start and a maximun point of end....

of he jumps up from say 1 to 100% and stops

thats may goal..!!

sWo0p
November 7th, 2002, 03:27 PM
yesssss.... i did it :)

dhuuu i was so simple :)

i juist made my movie clip very small

thanks for help...~!

lostinbeta
November 7th, 2002, 05:11 PM
Awesome :)

I am glad I could help. And don't worry about using too much code... I have the same problem. I can't optimize my code for anything.

I can optimize it a bit, but I always seem to miss something that I can optimize :)

h88
November 7th, 2002, 05:13 PM
well, i got a good resources on optimizing ur Actionscript, if it is needed, i would post it as a thread

lostinbeta
November 7th, 2002, 05:15 PM
If it is the one that was posted on bits forum, I already have it :)

A lot of it I know how to do, I just overlook it :-\ :P

h88
November 7th, 2002, 05:16 PM
which one, "flasm"?

lostinbeta
November 7th, 2002, 05:19 PM
Yep :)

sWo0p
November 8th, 2002, 08:20 AM
i think its i need to show you the result :P for al you hard work :)






It's a work in progress.. :) (use your mouse over the image)
check rest of the site here (http://213.46.31.46/other.designs/sneaknet/index.html) tell me what you think of it :) (oh yeh and dont minde the button menu :)

Added a little extra stuff to it, if you wanne see the code ask and i'll post it :)

lostinbeta
November 8th, 2002, 12:08 PM
Thats pretty good. Good job :)

One question about the site though.... why do you have the name of the link come up next to the name of the link when you roll over it on the main menu?

sWo0p
November 8th, 2002, 01:09 PM
Like i say, dont minde the buttons.. :) its a little error in the script :)

did'nt get to it yet :) bin buzy FLASHING

lostinbeta
November 8th, 2002, 02:29 PM
Oh ok :)

Good Luck with everything!