1 Reply Latest reply on Sep 15, 2006 2:16 PM by NSurveyor

    Random Sound script - Variable name problem?

    mikamatt
      I am trying to play one of three intro sounds on a certain frame of a
      movie. Heres the AS I have so far:

      set ("sound", "RandAud"+Math.round(Math.random()*3));

      trace(sound); // returns RandAud1 or RandAud2 or RandAud3

      sound.gotoAndStop("play");

      //RandAud1.gotoAndStop("play");
      //RandAud2.gotoAndStop("play");
      //RandAud3.gotoAndStop("play");

      When the movie plays var_sound is echoed properly as RandAud#, but the
      sound will not play.

      All of the commented out lines play the sound properly. Is there
      something wrong with the way the variable name is passed? Any help
      would be much appreciated.

      Thanks,

      Matt Mika