Topic: Any Flash Guru's here?? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=11373" title="Pages that link to Topic: Any Flash Guru&amp;#039;s here?? (Page 1 of 1)" rel="nofollow" >Topic: Any Flash Guru&#039;s here?? <span class="small">(Page 1 of 1)</span>\

 
BadZodiac
Obsessive-Compulsive (I) Inmate

From: Michigan, USA
Insane since: Nov 2002

posted posted 11-12-2002 01:00

How do I pass a variable from the main timeline to a loaded movie clip.

Layout: Main timeline contains audio voice over. Keyframes swap the value of SILENT from 0 (talking) to 1(not talking) to be passed to movie clip.

Movie clip is a 4 keyframe, 8 frame movie made to loop randomly. Frame 1 contains the mouth not talking, frames 3, 5 and 7 have the mouth in various vocal positions (2 frames each mouth position).


In each keyframe of the movie clip I have the following script:

while (_level0.silence==0) {
var mouth=Math.round(Math.random()*3)
gotoAndPlay((mouth*)+1);
}
gotoAndPlay(1);

When I test the movie, I get an error message "A script in this movie is causing your computer to run slowly. Abort this script?"

Upon aborting the movie clip plays, but looping sequentially.

How can I fix this?? Tell me this is an easy one....



I'm lost and have gone looking for myself. If I should return before I get back, please as me to wait.

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 11-12-2002 01:48

OK over to the Multimedia fourm for you......

___________________
Emps

FAQs: Emperor

BadZodiac
Obsessive-Compulsive (I) Inmate

From: Michigan, USA
Insane since: Nov 2002

posted posted 11-12-2002 03:41

Thank you for your guidence

I'm lost and have gone looking for myself. If I should return before I get back, please as me to wait.

Steve
Maniac (V) Inmate

From: Boston, MA, USA
Insane since: Apr 2000

posted posted 11-12-2002 19:58
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).]

Steve
Maniac (V) Inmate

From: Boston, MA, USA
Insane since: Apr 2000

posted posted 11-12-2002 20:41

'Course you know this approach is just going to hit a random frame (except 1) every frame cycle, side-stepping all the code you might have in those frames. If your movie is set to 12 fps, that means 12 times a second the clip event will choose a random mouth-frame to play. If that's not acceptable, we'll have to think of something else.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu