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

- Code is the heart of all multimedia productions. Code can animate your creative visions.
Per Thykjaer Jensen teaches multimedia programming at Aarhus Buisiness Academy. He is MA it, interaction design and multimedia, MA literature history and BA art history.