Let's define a growingUp symbol with autoplay property set to true which grows up a rectangle from bottom to top of the stage in 5s.
• a boolean property reverse initialized to false ;
• a function to switch the direction based on the direction and the current cursor x value e.pageX (e is the event object passed as a parameter ; stage width : 400) :
switchDirection: function( e)
var symAnima = sym.getSymbol('growingUp');
if (ANIMA.reverse && e.pageX <200)
ANIMA.reverse = false;
else if (!ANIMA.reverse && e.pageX >200)
ANIMA.reverse = true;
Stage > mousemove event handler
The example file is downloadable here : https://app.box.com/s/ivqjhao17m4jbg4ldf9q
Sorry, Salieri_purple, I made a mistake posting an answer to another thread .
But I will answer to yours.
Ha, I'm glad you said, I was puzzling over your code thinking 'do I dare tell this person I don't think this answers the question?'
1 person found this helpful
Rereading your post, I cannot clearly understand what you are after .
But may be you could adapt the same logic as detailled above (in response to a neighboring problem, hence my mistake). In your case,
• instead of firing the switch function on mousemove, you will call it in yourButton.click event handler ;
• you will adapt the function, keeping the boolean part, but getting rid of the e.pageX tests.
If this doesn't help, please provide another description of the behavior you want to code and I will post a sample file (later : now, I have to go).