Facial Expressions

[swf src=”http://petj.mmd.eal.dk/downloads/dice.swf” height=400 width=550]

Here is a method where you can control a movie inside another movie. The strange beast on the top left has a dice face. It’s the same movie as the dice rolling. So by changing the frame you can control fairly complex animations.


/*
FACIAL EXPRESSIONS
How to control a movie inside another movie.
In a keyframe try the following:
*/


addEventListener(Event.ENTER_FRAME,faceshift);
function faceshift(event:Event) {
kitty.kFace.gotoAndStop(3); // stops at face 3
}

The trick is in this codeline:

  • kitty.kFace.gotoAndStop(3);

Here you control a movie inside another movie. So on the stage you see a kitty. Inside kitty is a movieclip named kFace. By gotoAndStop / Play you can control animations like facial expressions and similar.

Tip: use onEnterFrame or buttons in order to control the movies.

Published by

Per Thykjaer Jensen

I am a Senior Lecturer in front- and backend web programming at the Multimedia Design and Communication Programme at Business Academy Aaarhus.

I speak several languages: PHP, Python, MySQL, JavaScript, Nodejs, HTML, CSS, and … Danish.

Background: MA it, interaction and multimedia – MA Literature history – BA Art History.