« Home « Kết quả tìm kiếm

ActionScript Elements


Tóm tắt Xem thử

- contains many of the essential elements that make up a typical script.
- After the script is a discussion of these elements and their role in the script's execution..
- //set the cost of the mug var mugCost:Number = 5.00;.
- //determine the total amount of the transaction var totalCost:Number = mugCost + totalTax;.
- //send the cashRegister_mc movie clip instance to frame 50 cashRegister_mc.gotoAndPlay (50);.
- In our sample script, the event that triggers the script is on (release).
- This event signifies that when the button to which this script is attached is released, the script will execute.
- The first line creates a variable named mugCost, sets its data type as Number (indicating the variable will hold a numeric value), and sets the value of the variable to 5.00.
- second line tells the cashRegister_mc movie clip instance to begin playing at Frame 50 of its timeline..
- Generally speaking, most of the lines in a script that are within curly braces.
- Once a variable has been created and assigned a value, that value can be accessed anywhere in the script simply by inserting the variable's name..
- Generally, anything between opening and closing curly braces signifies an action or set of actions the script needs to perform when triggered.
- to set the rotation property of a movie clip instance named wheel_mc, you would use the syntax:.
- Notice how a dot separates the name of the object from the property being set..
- To tell the same movie clip instance to play, invoking the play() method, you would use the syntax:.
- Once again, a dot separates the name of the object from the method invoked..
- Look at the last line of our sample script that tells the cashRegister_mc movie clip instance to go to and play Frame 50:.
- These are used to denote textual data in the script.
- Because text is used in the actual creation of the script, quotation marks provide the only means for a script to distinguish between instructions (pieces of data) and actual words.
- These are lines in the script preceded by two forward slashes.
- They indicate descriptive notes about what the script is doing at this point in its execution.
- (The AutoFormat feature of the Actions panel takes care of most of this for you.) You can nest code blocks within other code blocks—a concept that will become clearer as you work through the exercises..
- will execute in the same way as:.
- In addition, there must be a space between the var keyword used when creating a variable, and the actual name of the variable

Xem thử không khả dụng, vui lòng xem tại trang nguồn
hoặc xem Tóm tắt