[Flash basic theory Lesson 16] Matrix Revolution [double cycle]

Source: Internet
Author: User

Back to "flash Basic Theory Class-Catalog"

In this lesson we will introduce two methods to achieve this effect, focusing on the double loop statement

Also introduce solutions that are not available in the Textfield._alpha method

Single loop:

for (i=0; i < 5; i++) {
 trace("i="+i);
}

The results of the operation are as follows:

i=0
i=1
i=2
i=3
i=4

Double loop:

is to add a for loop in the For loop

for (i) {
   for(j) {}
}

Let's look at a double loop example

for (i=0; i < 5; i++) {
 for (j=0; j < 3; j++) {
  trace("i="+i+" j="+j);
 }
}

The results of the operation are as follows:

i=0 j=0
i=0 j=1
i=0 j=2
i=1 j=0
i=1 j=1
i=1 j=2
i=2 j=0
i=2 j=1
i=2 j=2
i=3 j=0
i=3 j=1
i=3 j=2
i=4 j=0
i=4 j=1
i=4 j=2
i=5 j=0
i=5 j=1
i=5 j=2
i=6 j=0
i=6 j=1
i=6 j=2
i=7 j=0
i=7 j=1
i=7 j=2
i=8 j=0
i=8 j=1
i=8 j=2
i=9 j=0
i=9 j=1
i=9 j=2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.