First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Paul Price

Controller Clip

A controller clip is an MC that uses clipEvents to control other clips on the stage. Some people simply use a blank clip as their controller clip, I chose not to do this because I am lazy and didn't feel like hitting F8 to make such a clip. Instead I just dragged a letter clip on the stage and used it as my controller clip, I set its visibility to 0 to ensure that it isn't seen. Well that's about it. All of this talk has set you for the disappointingly simple scripts that follow.

 

onClipEvent Scripts for Controller Clip

onClipEvent (load) { 
//loop through input fields and throw their text into the  message array 
//NOTE: You can just the message array with your own messages and  nix the input fields 
messages=new Array(); 
for (c=0;c<=2;c++){ 
messages.push(_root["input"+c]);  
//hide this clip because it should not been seen 
              } 
this._visible=0; 
//initialize  variables 
i=0; 
x=0; 
} 
onClipEvent (enterFrame) { 
//Loop through array one frame  at a time. 
if (i‹messages[x].length){
//attach clips and set letters and spacing	
	_root.attachMovie("letter","lettery"+i,i);
//short hand
with (_root["lettery"+i]){
	text=messages[x].charAt(i);
	_y=100;
	_x+=300+20*i;
	gotoAndPlay(random(_totalFrames/15));
   }
//Once the clip is attached increment i by 1
i++;
//Make sure i isn't greater than message 
}
else if (i >=messages[x]Length){ 
if (z>=_root.controller._totalFrames){ 
/*The above line  makes sure that the last clip has 
finished its animation before it removes the old clips*/
for (k=0;k‹messages[x]Length;k++){
//Remove old clips
	removeMovieClip(_root["lettery"+k]);
 }
//increment our message array value because the first item is finished
x++;
/*Once all of the messages have played, do something. 
You can just reset variables to keep it cycling.*/
If (x>=messages.length){ x=0; _root.gotoAndStop(1);}
 //Reset variables 
z=0; i=0; 
            }
 //Keep track of frames entered 
z++; 
//Buy my book, The Real Work: Essential Sleight of Hand for Street Operators.  
//Visit http://www.chapterzero.org for more info.
    }
 }
 
» Level Intermediate

Added: 2001-11-08
Rating: 7 Votes: 202
(10 being the highest)
» Author
No details available.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.