code:
while (_level0.silence==0) {
var mouth=Math.round(Math.random()*3)
gotoAndPlay((mouth*)+1);
}
gotoAndPlay(1);
What do you mean by (mouth*)? I'm confused by that.
And also - if a value of 0 for "silence" means no talking, doesn't your script send you to a "talking" frame when silence==0?
I'd probably attempt an onClipEvent for the movie clip with the mouth graphic (BTW - is the mouth graphic a clip inside the attached clip, or is mouth the attached clip? That will matter for how you address the mouth.)
Try something (roughly) along the lines of
code:
onClipEvent(enterFrame) {
if (!_root..silence==0) {
var mouth=Math.round(Math.random()*7)
this.gotoAndPlay(mouth+1);
} else {
this.gotoAndStop(1);
}
}
Granted this is pretty rough - don't copy and paste! But first of all if it's an 8 frame clip you want random to be calculated on 7 frames, right? (I always struggle with random - check me on this) since frame 1 has the mouth closed.
So my clip event checks the boolean value of "silence". By convention, 0 is the same as false, 1 is the same as true. The clip event checks to see if silence is true (1) or false(0). If it is NOT false, it goes to and plays a random frame that is not 1. (the exclamation point means "not" - in other words, "if silence==0 is not true...") If silence is 0 (false), it goes to and stops at 1, the mouth closed.
Hope this is of some help. I could be way off the mark here, but for continuously checking the value of a variable, I think an onEnterFrame clip event is your best bet.
In any event, instead of passing a value FROM _root (or _level0) TO the clip, the clip is continuously looking back to _root to GET the value. Sorta reverse logic from your idea.
BTW - this is Flash 5 technique. Flash MX still has clip events, but I think maybe you put 'em in different places? Anyway. With Flash 5, you click the graphic, the ActionScript editor changes from "Frame Actions" to "Object Actions", and you type away.
[This message has been edited by Steve (edited 11-12-2002).]