Newbie? on logic operator -=
Hey all,
I’m new to actionscript and am doing a tutorial in a book that moves a car from one end of the screen to the next by buttons.
When you release a button it moves the car 10 pixels more down the X axis.
The code confuses me and I want to understand it Please Help!
Here is the code:
// stop the cars traveling
stop();
// callback for onPress event on ‘back’ button
back_btn.onPress = function() {
// move my car -10 pix
myCar_mc._x -= 10;
};
// callback for onPress event on ‘forward’ button
forward_btn.onPress = function() {
// move myCar +10
myCar_mc._x += 10;
};
Why does the - sign and + sign appear before the = instead of after?
Is this a logic operator(-= or +=)?
Why doesn’t putting the - sign or + sign after the = work?
Thank you so much for your time and help!
-Drred
:pleased: