Phản ứng để người dùng tương tác người dùng tương tác với một bộ phim thông qua chuột hoặc bàn phím, hoặc trong đó có thể được sử dụng trong một số cách di chuyển con trỏ chuột trên màn hình, nhấn và thả nút hoặc phím, và vv. | Reacting to User Interaction Users interact with a movie via the mouse or the keyboard either of which can be used in a number of ways moving the mouse pointer around the screen clicking and releasing buttons or keys and so forth. Using conditional logic you can script a movie to react in various ways based on the user s interaction with the movie. In the following exercise you ll add functionality that allows the user to press the Spacebar on the keyboard to apply thrusters that move the rocket upward at a quicker-than-usual pace. 1. Open . We ll continue building on the file you worked with in the preceding exercise. When the movie first begins to play the setWeatherConditions function is called and takes several actions based on the value of a variable named randomWeather it displays a random weather graphic and sets the values of the variables thrust and noThrust. The variable thrust is given a value double that of noThrust at the time the variables are set. If noThrust has a value of 2 for example thrust has a value of 4. Farther down in the script we ve been building the speed variable is set to the value of noThrust. If noThrust has a value of 2 for example speed has the same value. Remember that the value of speed is used to determine how fast the rocket moves upward. In this exercise we ll set the value of speed to either thrust or noThrust depending on whether the Spacebar is pressed. 2. With the Actions panel open select Frame 1 of the Actions layer and add this script at the end of the current script 3. 4. function rocketThrustIncrease 5. 6. if rocketLaunched 7. 8. speed thrust 9. 10. on 11. 12. 13. 14. 15. 16. rocketThrustIncrease 17. The first part of this script defines a function named rocketThrustIncrease . The if statement in this function looks for two conditions whether rocketLaunched has a value of true and whether the Spacebar is pressed. If both conditions are .