PDA

View Full Version : one button controls bouncy scale


decode5238
10-08-2003, 09:34 PM
hi, guys, I am a newbie here !!
I've created a bouncy scale box (movieclip) and a button to control it.
the problem is I only know how to make the box bounce to a certain scale.

what if I need it to bounce back to it's oringinal value ?? meaning click the button only once and make the box bounce to a certain scale AND THEN bounce back to it's original size.

I put this code on the MC (thanks to Pixelwit)

onClipEvent (load) {
drag = .35;
flex = .45;
goalscale = 200;
step = 0;
}
onClipEvent (enterFrame) {
step = (step*flex)+((goalscale-_yscale)*drag);
_yscale+ = step;
}


I wanna trigger this MC to goalscale = 800
AND THEN back to goalscale = 200 with one click


how do I do this ?? thanks a lot :)

pixelwit
10-09-2003, 02:04 AM
Hello decode5238.

[useastags]

With that said, try playing around with this idea:onClipEvent (load) {
drag = .35;
flex = .45;
goalscale = 800;
step = 0;
}
onClipEvent (enterFrame) {
step = (step*flex) + ((goalScale-_xscale)*drag);
_xscale = _yscale += step;
// the next line determines when easing is complete
if(Math.abs(_xscale-goalScale)<.1 && Math.abs(step)<.1){
goalScale = 200;
}
}Hope it helps,

-PiXELWiT
http://www.pixelwit.com

decode5238
10-09-2003, 03:43 AM
hi, Pixelwit

can't believe it's you. haha
the bouncy box code that I found from a forum(don't remember which one) was provided by you
and that really helped me a lot!!!!
I appreciate it soooo much but hadn't thought I would have chance to talk to you ..... this is sooo cool :D thanks a lot !!

as to your reply, I did play around with the code and that works well on a MC. But I still have no idea how to use a button to do that.

I think I should try to make it more clear, my bad ..
what I did is

on the movieclip


onClipEvent (load) {
drag = .35;
flex = .45;
goalscale = 800;
step = 0;
}
onClipEvent (enterFrame) {
step = (step*flex) + ((goalScale-_yscale)*drag);
_yscale += step;
}


on the button



on(release){
goalscale=60;
}


so, I already make the box's yscale bounce to 60,
What I need is after the box bounces to 60, with no extra click on button, it bounces back to 800.

can you help me with that ?? thanks a million!!!!

pixelwit
10-09-2003, 03:27 PM
onClipEvent (load) {
drag = .35;
flex = .45;
finalScale = 100
goalscale = 300;
step = 0;
}
onClipEvent (enterFrame) {
step = (step*flex) + ((goalScale-_xscale)*drag);
_xscale = _yscale += step;
// the next line determines when easing is complete
if(Math.abs(_xscale-goalScale)<.01 && Math.abs(step)<.01){
goalScale = finalScale;
}
}
// code on button
on (release) {
Box.goalScale = 50;
Box.finalScale =400;
}That should do the trick.

-PiXELWiT
http://www.pixelwit.com

decode5238
10-10-2003, 06:55 PM
hi, Pixelwit

I did it !!!! and it works very well !!! thanks a lot .

I think I should retake my math class ..... :(


thanks for sharing your time and knowledge !!!!


Decode5238

pixelwit
10-10-2003, 07:10 PM
Welcome.

Glad to have helped.

-PiXELWiT
http://www.pixelwit.com