Exercise 6 Moody Face
syllabus | schedule | assignments | Web Resources | ARTC courses

1) Create (on stage) an unexpressive face of a character using the drawing tools.

2) Convert these vectors into a movie clip symbol called: face and give it an instance name in the property inspector called: myFace.

3) On the main timeline (Scene 1), name the layer with your movie clip: myFace. Create a new layer called actions.

4) Double click your character symbol on the stage to enter its timeline.

  • Call the layer with your character: myCharacter.
  • Make a new layer called labels.
  • Create new key frames for frames 2, 3, and 4 on both layers.
  • Give frame labels for frames 1-4 by clicking on the frame in the labels layer and using the property inspector, name as follows: Frame 1 - normal, 2 - sad, 3 - happy, 4 - angry.
  • Manipulate the vector faces for each of these frames to make the face correspond to the frame label emotion.

5) Go back to scene 1, and make a new layer above the myFace layer, call it: moods.

  • Use the text tool to create a text box on stage.
  • Convert this to an input box by selecting INPUT TEXT in the text options of the property inspector with options:
    • Instance Name = theInput
    • Show Border = on (third icon to the right of the line type - single line.


6) Using the Text tool again, make a second text box and type in it, type: normal, sad, happy or angry and convert this text box to STATIC TEXT in the text options of the property inspector.

7) In frame 1 of the actions layer of the main timeline, open the actions panel (notice the top of the actions panel says: frame), and type the blue part of the following code (the red is comments explaining what the code does):

//pause the actual MC, not the movie. If you pause the movie with a
//plain old stop(); the MC will continue to run based on its internal timeline.
myFace.stop();
//declare and initializes variables:
theInput.text = "";
mood = "";

8) Create a new layer below the actions layer on main timeline called button - make a button in that layer and call it: button. Click once on the button (on stage) so it is highlighted and open the actions panel (notice the top of the actions panel says: button), type:

on (release) { //event

mood = theInput.text; //this long list of instructions is the event handler.

//the text in " " refers to the frame labels that were created earlier.
//the labels mark specific frames in the movieclip: myFace.

if (mood == "normal") {
myFace.gotoAndStop("normal");
} else if (mood == "sad") {
myFace.gotoAndStop("sad");
} else if (mood == "happy") {
myFace.gotoAndStop("happy");
} else if (mood == "angry") {
myFace.gotoAndStop("angry");
}

}

9) TEST movie.

Example:


Student Sample

NOTE: Consider doing one or more of the following:

  • Double-click into the myFace movie clip, and use movie clips in place of static graphics on each of the frames.
  • Create smooth transitions from face to face.
  • Add other emotions.
  • Use different event handling.
  • Design a more intricate interface for the user to enter info.