How to start this ActionScript Stuff? -Tell me about the ActionScript?-It uses... (part 1)
Wish from the chapter "Think like computer" , you have an impression of being into programming mind.
Now, wish you keep this mind and start to exercise it in this section.
Programming is like human's language has grammars (syntax). When we are writing, We use " " to express someone in speech, and use "," to express break, and use "." to express ending.
To express your thought to computer while writing ActionScript, you have the chose of using "()" , "{}", ".", ";"
- You use {} to group all the word you want to say, the action you are going to make.
- You use () to identify the special situation you want to do in action.
- You use . to make the path and relationship, and lead to target you want to find.
- You use ; to end your speech, the end of action.
|
Example:
On(press)
{
gotoAndPlay(1);
_root.movieClip.stop();
}
- Here it used {} to group to actions "gotoAndPlay(1);" and "_root.movieClip.stop();"
- Here it used () to identify the action is "press"
- it used () to tell the action of "gotoAndPlay" is set to frame 1
- Here it used ; to end both actions,"gotoAndPlay(1);" and "_root.movieClip.stop();"
-
Here it used . to lead action to the aimed target, "_root" then "moveiClip" then "stop"
|
Explain:
?{}(object initializer)? , ?()(parentheses)? , and ?.(dot)? are called Operator in ActionScript?s syntax, there have many other Operator symbols you might have met or will see, such as ?=?, ?[]?, ?+? , ?==? etc. (however, if you are curious about their meaning, you can use the Help panel, searching for Operator, then you?ll get a list of all Operator symbols). With Operator, it makes the codes meaningful, and has the rule of logic to execute. Imaging , you said I have an apple ?==? (equals to) yours, and he also has an apple ?==?(equals to) yours, now you write ActionScript to ask Flash show your apple, then we?ll still get the result of an apple!(without telling it directly how is your apple looks) The computer uses the logic and figures out your apple is the same as mine, and the same as his, so gives us the correct answer. This is how the Operator is used and makes the logic. Your job is just to write things in logic to computer to get the result you want to.
You may have question about the ordering while using "." , I couldn't explain very detail about this to you now, because it will involve with the idea of the entire Object Oriented Programming, but you just remember for now that the ordering while using "." starts from the thing that is top to bottom, big to small, near to far.
Of course, these things are still not enough to express like our human language dose, so we will add verb, noun, adjective? etc into ActionScript. We will continue this topic in the part2.
|
|
*go to part 2*
|
|
|
--Index--
|
  
|
|
| Project Log
|
 | New tips | (Jan 28th,2004) Pass value of ASP querystring to FlashMovie rather useing loadVariables method.
|  | Piano Chords Finder | (Oct 4,2004) After a little tired of making flash for web, started making this music tool to entertain myself hee:)
|  | New Tutorial | (Sep 19,2004) Glad...Once I had topic about web programming. ActionScript is such a cute thing that gives designers so much imagination to explore.
|  | player 3.0 | (Sep 9,2004) A new design from mp3 streaming player2.0, also add volume control.
|
|
|
Never imagine how you want to be creative.
|
|