ThemeForest

Differences between += & -=

153 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Bought between 1 and 9 items
  • Europe
AphroditeDesign says

Where is the difference? Sorry for my question but I learn AS3 .0 only few days. Thanks.

3 years ago
1945 posts
  • Has been a member for 4-5 years
  • Exclusive Author
  • Sold between 5 000 and 10 000 dollars
  • Bought between 10 and 49 items
  • Netherlands
  • Referred between 10 and 49 users
Emroni says

its adding or removing a certain amount from a variable. x += 3 will add 3 to x. x -= 2 will subtract 2 from x. Same as x = x – 2 :)

3 years ago
6468 posts
  • Has been a member for 4-5 years
  • Won a Competition
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 50 and 99 items
  • United Kingdom
  • Referred between 10 and 49 users
MSFX says

also…

i++

is the same as

i = i + 1

is the same as

i += 1

and subtracting is similiar syntax…

i—

is the same as

i = i – 1

is the same as

i -= 1

:)

3 years ago
MSFX is a moderator
153 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Bought between 1 and 9 items
  • Europe
AphroditeDesign says

Thanks guys.

3 years ago
465 posts
  • Has been a member for 3-4 years
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 100 and 499 items
  • United States
3860 posts
  • Has been a member for 5-6 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Author had a Free File of the Month
  • Beta Tester
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 100 and 499 items
  • United Kingdom
  • Referred between 200 and 499 users
flashjunkie says
You might want to keep this cheat sheet handy ;) http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/operators.html

nice one! bookmarked! :D

3 years ago
2309 posts
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Beta Tester
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 1 and 9 items
  • United States
  • Referred between 10 and 49 users
theflyingtinman says
also…

i++

is the same as

i = i + 1

is the same as

i += 1

Strictly speaking that is not quite true. It is true in terms of the resulting value of the variable i but all of these statements return a result which can be used in other expressions and the returned results are not the same; ( i += 1 ) and ( i = i + 1 ) return the value of i after incrementing but the post-increment operator ( i++ ) returns the value of i before incrementing.

However, if you do ever have cause to use the value returned by the statement, and need the value after incrementing, and want to keep the code as concise as possible, then the pre-increment operator ( ++i ) can be used to get the desired result.

3 years ago
4324 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Interviewed on the Envato Notes blog
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 1 and 9 users
Reaper-Media says
You might want to keep this cheat sheet handy ;) http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/operators.html
nice one! bookmarked! :D

+1 Bookmarked!

3 years ago
Reaper-Media is a moderator
4324 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Tutorial to a Tuts+ Site
  • Contributed a Blog Post
  • Interviewed on the Envato Notes blog
  • Grew a moustache for the Envato Movember competition
  • Community Moderator
  • Beta Tester
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Bought between 10 and 49 items
  • United Kingdom
  • Referred between 1 and 9 users
Reaper-Media says
also…

i++

is the same as

i = i + 1

is the same as

i += 1

Strictly speaking that is not quite true. It is true in terms of the resulting value of the variable i but all of these statements return a result which can be used in other expressions and the returned results are not the same; ( i += 1 ) and ( i = i + 1 ) return the value of i after incrementing but the post-increment operator ( i++ ) returns the value of i before incrementing.

However, if you do ever have cause to use the value returned by the statement, and need the value after incrementing, and want to keep the code as concise as possible, then the pre-increment operator ( ++i ) can be used to get the desired result.

The words of a true flash guru, tinman you rock!!!

3 years ago
Reaper-Media is a moderator
2309 posts
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Beta Tester
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 1 and 9 items
  • United States
  • Referred between 10 and 49 users
theflyingtinman says
The words of a true flash guru, tinman you rock!!!

Lol … actually that knowledge comes from my status as a c++ guru, and it just happens to apply in AS3 … but I’ll accept a “Flash Guru” badge if anyone is handing them out ;)

3 years ago
by
by
by
by
by