Syllabus

---------------------

Calendar/Schedule

---------------------

Lecture Notes

---------------------

Projects

---------------------

Resources

---------------------

Student Work

 

 

     

Art 444 Lecture Notes

Adding a counter:

1. Establish a counter in your script with: counter = 0;

2. Increment the counter by adding this script to a conditional statement:

if (this._droptarget == "/trashcan"}
__counter ++;

3. Add a new condtional statement within the first conditional for the counter total:

if (this._droptarget == "/trashcan"}
__counter ++;
__if (counter == 3 ) {
__trashcanLid_mc.play();
__}

The script above specifies if the counter recieves a total of 3 objects then the trashcanLid_mc will begin playing. To create counter for both wins and losses establish a wincounter and a losecounter in your script.

Here's the complete script:

counter = 0;

fish.onPress = function() {
______this.startDrag();
};
fish.onRelease = function() {
______stopDrag();
______if (this._droptarget == "/can") {
___________this._visible = false;
__________counter ++;
___________
if (counter == 3 ) {
___________trashcanLid_mc.play();
___________}
___________} else {
_____________this._x = 250;
_____________this._y = 100;
_____
}
};

Adding a timer:

  1. Create a MC called "timer" and place a copy on or off the stage. Give it an instance name and open its timeline.
  2. For each second of your timer, place a keyframe with a corresponding number. If your frame rate is 12 fps, then you will place a number on every twelfth frame.

On the last frame of the MC's timeline write the following script:

_root.gotoAndPlay("lose");

* "lose" is a frame label on your _root timeline.

The above will jump to the "lose" label and play once the timer reaches this frame.

Back to top of page | School of Art, Design and Art History | SDSU Main