Flash Animation: The Matrix Special Effects - ActionScript

Home • Members Tutorials Forum iSnapChat Contact Us 

 


Flash Tutorials

   

Flash Tutorial - The Matrix Special Effects

 

Free Flash Tutorial


Step 7    <<   Previous      Intro   1   2   3   4   5   6   7   8   9   10     Next   >>      

 

Step Seven: The ActionScript

  1. Insert a new layer Insert > Timeline > Layer
  2. Name the layer: Actions
  3. Select Frame 1 of the: Actions Layer
  4. If the Actions Panel is closed, open it: Window > Actions (F9)
  5. Type (or copy & paste) the following actions:

    var SSX = 30;
    var SSY = 30;
    var XSPACING = 20;
    var YSPACING = 20;
    var spans = new Array(SSX);
    for (y=0; y < SSY; y++) {
       for (x=0; x < SSY; x++) {
          var n = y * SSX + x;
       if ((((x*5 ^ y*3)) & 3) == 0) {
          duplicateMovieClip("myCharacters", "c"+n, n);

    /* Only add the following code (by removing the "//") if you have created individual MCs for specific letters such as A, B, C & D etc. Note the first Instance Name would go in the line above instead of: myCharacters The rest of the go in the lines below. Change my Instance Names to match yours. */

    // } else if ((((x*5 ^ y*3)) & 4) == 0) {
    // duplicateMovieClip("myMC_B", "c"+n, n);

    /* If you have more MCs, repeat the two lines of code as necessary incrementing the count like this:  */

    // } else if ((((x*5 ^ y*3)) & 5) == 0) {
    // duplicateMovieClip("myMC_C", "c"+n, n);

    /* Your very last MCs Instance Name would go in the line below instead of:
    myCharacters  */

          } else {
             duplicateMovieClip("myCharacters", "c"+n, n);
          }
          with (this["c"+n]) {
             _x = x*XSPACING+XSPACING;
             _y = y*YSPACING;
         }
       }
    }
    for (x=0; x<SSX; x++) {
       y = Math.random()*SSY*8;
       spans[x] = -(int(y));
    }

  6. Select Frame 2 of the: Actions Layer
  7. Insert a blank Keyframe: Insert > Timeline > Blank Keyframe (F7)
  8. With Frame 2 still selected type (or copy & paste) the following actions:
  9. for (x=0; x<SSX; x++) {
       if (spans(x)>=0) {
          n = spans[x]*SSX+x;
          this["c"+n].gotoAndPlay(2);
          if (spans[x]>=SSY) {
             n = Math.random()*SSY*8;
             n = int(n);
             spans[x] = -n;
          }
       }
       spans[x]++;
    }

  10. Select Frame 3 of the: Actions Layer
  11. Insert a blank Keyframe: Insert > Timeline > Blank Keyframe (F7)
  12. With Frame 3 still selected type (or copy & paste) the following actions:
  13. gotoAndPlay(2);

  14. Test your Movie: Control > Test Movie (Ctrl Enter)

    Your Movie is done! In the next section the ActionScript is explained.

         

Step 7    <<   Previous      Intro   1   2   3   4   5   6   7   8   9   10     Next   >>      


50835 visitors to this page since 11 May 07 •

Phil Schulz's Facebook Profile
Webwasp is Phil Schulz's baby. You are welcome to contact me or become my Facebook friend: Click here

 Top of Page HomeMembers Tutorials Forum iSnapChat Contact Us 
 All material on this site is protected under international copyright © law. DO NOT reproduce any material from this site without written permission. Please ask as permission is often granted.