tailieunhanh - adobe flash cs5 on demand part 59

àm việc với Loops Vòng cho phép Flash để thực hiện một hành động lặp đi lặp lại. Bạn có thể sử dụng một vòng lặp để tạo ra một trình đơn thả xuống năng động, xác thực dữ liệu, tìm kiếm văn bản, bản sao các đoạn phim, và thậm chí phát hiện va chạm trong các trò chơi có đạn và các đối tượng | Working with Loops Loops allow Flash to perform an action repeatedly. You can use a loop to create a dynamic drop-down menu validate data search for text duplicate movie clips and even detect collisions in games that have projectiles and objects. Conditional statements let you execute an action based on a specific condition. You can have a specific action continue to loop until a certain condition is met. For example continue to search for a specific text string until it is found or the end of the text document is reached. Loops come in two forms While loops and For loops. While loops wait for a specific condition to start or stop the loop. That may sound similar to the For loop with one exception The For loop is self-contained and the While loop works with an external condition or one outside the scope of the loop. While Loops. While loops continue to execute while a certain condition exists keep looping or searching until a specific value is reached. i 4 while var i 0 newMC i i i-- For Loops. For loops are selfcontained counters. For example loop repeat the action ten times and then stop. x x for x 0 x 10 x myClip x x 45 x 10 When you create a Looping action you can further control the loop by using the following loop exceptions Continue. The continue exception lets you stop the current loop from performing its actions and jump directly to the next cycle of the loop. Break. The break exception is used to exit a loop even if the original condition that is driving the loop is still true. For example if you create a While loop using the following script total 0 i 0 while i 20 if i 10 continue total i The results would be a script that executes and adds 1 to total unless the value of i equaled 10. This would create a sequence of numbers 1 2 3 4 5 6 7 8 9 11 12 13 14 15 16 17 18 19 20. If you had used the break exception in place of continue the values would read 1 2 3 4 5 6 7 8 9. Therefore it loops