all groups > flash actionscript > august 2005 >
You're in the

flash actionscript

group:

Button Problems



Button Problems Barnicle Fiend
8/12/2005 11:19:04 PM
flash actionscript: Hi,

Im playing with the Robert Penners Easing Equations extension to flash and can
make a ball bounce, but only once.
I have set a variable called state and the variable is working, but i cant
make the ball (symbo)bounce every time i roll over my button(ball)
When i test the movie, on rollover symbo bounces but only once, if i roll over
again nothing happens.

I am new to actionscript and dont understand alot of the basics.
Any help would be appreciated.

Cheers

My actionscript:

#include "lmc_tween.as"

ball.onRollOver = function() {
if (_root.state == 0) {
symbo.slideTo(400,200, 1.8, "easeoutelastic")
_root.state++
} else if (_root.status == 1) {
symbo.slideTo(400,-250, 1.8, "easeoutelastic")
_root.state--
}
}
Re: Button Problems kglad
8/13/2005 12:03:17 AM
try:

ball.onRollOver = function() {
if (_root.state == 0) {
symbo.slideTo(400,200, 1.8, "easeoutelastic")
_root.state++
} else if (_root.state == 1) { //<-- you have typo here
symbo.slideTo(400,-250, 1.8, "easeoutelastic")
_root.state--
}
}

Re: Button Problems Barnicle Fiend
8/13/2005 12:09:52 AM
lol, you wouldnt believe the amount of time ive spent looking at that code and totally missing that.

Re: Button Problems kglad
8/13/2005 12:19:09 AM
you're welcome. learn to use the trace() statement. it will save you many
hours of debugging. a simple:

ball.onRollOver = function() {
if (_root.state == 0) {
symbo.slideTo(400,200, 1.8, "easeoutelastic")
_root.state++
trace(_root.state);
} else if (_root.status == 1) {
symbo.slideTo(400,-250, 1.8, "easeoutelastic")
_root.state--
trace(_root.state++);
}
}

would reveal that your else-if branch is not executing despite _root.state
being equal to 1. that would cause you to focus your attention on that else-if
statement.
AddThis Social Bookmark Button