1 Reply Latest reply on Mar 28, 2008 5:20 AM by robdillon

    sound only turns on if you win

    kcrain
      I have a short little flash game. Music plays while the player looks for hidden objects.

      When they find all of the hidden objects a movie clip loads to say "you win" and an applause.mp3 plays.

      If they dont find all the objects in time at the end of the times line "out of time you lose" shows.

      **My problem is, when the person doesnt find all the objects and it reaches the end of the timeline the "applause.mp3" still plays. I have the "winner" movieclip set to be invisible until all the objects are found but dont know how to keep the sound off.

      here is the code I have:

      // here I set the variables to mark if they are found
      var object1Found = false;
      var object2Found = false;
      var object3Found = false;
      var object4Found = false;
      var object5Found = false;
      var object6Found = false;

      // here I put a function so I dont have to repeat the code for each
      function displayIfWinner()
      {
      if (broccoliFound && meatFound && eggFound && mushFound && carrotFound && spinachFound) {
      _root.gotoAndPlay(465);
      }

      //right before the Winner movieclip on the timeline I have this action

      winner._visible = false

      **This is where my problem is. The Winner movieclip in invisible but the "applause.mp3" is still playing
        • 1. Re: sound only turns on if you win
          robdillon Most Valuable Participant
          How are you telling the sound to play? Are you using a sound object, or is the sound file just embedded into the movieClip winner?

          If you aren't using actionscript to play the sound, then you could put the sound file to start at frame 2 of the movieClip, put a stop() on frame 1 and only play the clip if there is a winner.