Script: Press two buts and go to...Like all the other files in the category memoclips this file is also based on variables, which hold information when a button is pressed including how often the button was pressed. stop(); //we give i a value. i is our memory variable. i=0; //tell the user what to do textField.text="Press a symbol now!"; //we create a new class of movieclips using "prototype". //all movieclips will inherit the properties when the function is called. MovieClip.prototype.pressMe = function(){ //change color of mc when mouseover this.onRollOver=function(){ thisColor = new Color(this); thisColor.setRGB(0xC6EFF7); } //main function executed when pressed on mc this.onPress=function(){ //i increments by one every time when pressed i++; //when one mc is pressed i=1 if(i==1){ //create variable to memorize which mc is pressed. //DO NOT place "var" in front, which will make //this variable local in the sense that a second //execution of the function by clicking a different symbol //is a "global" and not a "local" event even within the //same function. newClip_1 = this; //the color of mc will change thisColor = new Color(this); thisColor.setRGB(0xFFFF00); //instruct what to do next textField.text="Press a second symbol."; } //if a second symbol is pressed and this symbol is not //identical to the first one... if(i>r=2 and newClip_1!=this){ //...we execute the functions according to which //symbol was pressed. if((newClip_1==circle or newClip_1==square) and (this==circle or this==square)){ gotoAndStop("cirsq"); textField.text="This is frame 2."; }else if((newClip_1==triangle or newClip_1==square) and (this==triangle or this==square)){ gotoAndStop("trisq"); textField.text="This is frame 3."; }else if((newClip_1==circle or newClip_1==triangle) and (this==circle or this==triangle)){ gotoAndStop("tricir"); textField.text="This is frame 4."; } //else if the same symbol was pressed instruct the user. }else if(i*bigger=2 and newClip_1==this){ //we set i back to 1 to start all over. i=1; textField.text="Press a DIFFERENT symbol."; } } } //execute the function for all three symbols circle.pressMe(); triangle.pressMe(); square.pressMe(); |