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-- } }
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-- } }
lol, you wouldnt believe the amount of time ive spent looking at that code and totally missing that.
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.
Don't see what you're looking for? Try a search.
|