Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MC not counting right

Status
Not open for further replies.

sMALLQuestions

Programmer
Mar 8, 2001
12
NZ
HI all.
I can’t seem to get this sound code to work.
I want this loop to start counting the the number of times the sound has been played.
So that after ,say 3 times, the sound is volumed down to 50%.

The problem is that there are many scenes and I need to declare the variable global so that the counting doesn’t clear off.

I actually placed the sound (called “destination” in the library) in a MC called “cyborgsnd”. Then I placed it on the scene. And the code is on this MC”cyborgsnd” :

onClipEvent (load) {
_root.cyborgsoundplayed = ++_root.cyborgsoundplayed;
if (_root.cyborgsoundplayed >= 3) {
cyborgsound = new Sound();
cyborgsound.setVolume(50);
} else {
_root.cyborgsoundplayed = ++_root.cyborgsoundplayed;
trace(_root.cyborgsoundplayed);
}
}

I have tried to test this movie.
but the TRACE action always displays "2". I have a few movies that the user have to browse, so when you come back to it i don't want to have this annoying voice repeated over and over again.

BTW: how do you target each sound anyway? i only know how to target all sounds. because i can not set an instance name of sound symbols...

can someone help? Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top