Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Actionscript 3.0 rookie question
Old 07-29-2008, 08:24 PM Actionscript 3.0 rookie question
StylaStyla's Avatar
Mad Man

Posts: 401
Name: Styla
Location: City of London
Trades: 0
edit: problem solved thanks to chrishirst!

Hi,

Never coded before but decided I will learn Actionscript 3.0 as my first programming language to give me a stranglehold on Flash as a whole.

So I've bought the Foundation Actionscript 3.0 with Flash CS3 and flex which so far has been a good read and at times I have been stuck on paragraphs trying to figure out the coding examples which I eventually come to terms with, however, I've come across one section which doesn't make sense to me:

In the section for Allowing for variable parameters

I cannot seem to understand what is going on here..

Quote:
straight from the book
When an arithmetic operator is followed by the assignment operator, the variable to thje left of the operators has its value operated upon along with the operand to the right of the operators, with the calculated result assigned directly back to the variable. here are a few more examples to help demonstrate.
Code:
var number:uint = 2;
number += 5; // results in 7 now being assigned to number
number -= 3; // results in 4 now being assigned to number
number *= 2; //  results in 8 now being assigned to number

The same operation can be used with the concatenation operator (+) with strings:
..etc
I'm sorry but I can't seem to figure out this system here. The variable number = 2, so 2 + 5 = 7 for the first, which makes sense but how does the result of 4 and 8 come around for the second and third examples?

p.s. While I'm at it; How difficult is this language, generally speaking? How was it for you AS-coders?

Thanks in advance!

Last edited by StylaStyla; 07-30-2008 at 10:50 AM..
StylaStyla is offline
Reply With Quote
View Public Profile Visit StylaStyla's homepage!
 
 
Register now for full access!
Old 07-30-2008, 05:22 AM Re: Actionscript 3.0 rookie question
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
After the first line "number" = 7, so the second line is deducting 3 from 7 (the value of "number") and so on.

2 + 5 = 7 -> 7 - 3 = 4 -> 4 * 2 = 8

In maths hierarchy the whole three lines would equate to:
(2 + 5 - 3) * 4

Calculator keys
2 + 5 = -3 = *2 = 8

ActionScript is to Flash what javascript is to browsers. Same syntax, different objects.

If you know javascript, ActionScript is no problem.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-30-2008, 07:57 AM Re: Actionscript 3.0 rookie question
StylaStyla's Avatar
Mad Man

Posts: 401
Name: Styla
Location: City of London
Trades: 0
Hi

Yes, that makes perfect sense now. I didn't think about the continuation of the sum - I just thought it all applied to the number rule.

anyway thanks for that, I can now progress with my book. It's also great to hear that Javascript and Actionscript are alike as I was wanting to learn a few more programming languages once done with Actionscript.

Thanks for the assistance.
StylaStyla is offline
Reply With Quote
View Public Profile Visit StylaStyla's homepage!
 
Reply     « Reply to Actionscript 3.0 rookie question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11694 seconds with 12 queries