3 Replies Latest reply on Feb 8, 2007 10:30 AM by Peter Lorent

    random frame AS not working for some reason

    Van Garnett Level 1
      I wrote the following code and got an error. It is code i got from a forum with about 15 people who said 'thanks, this words perfectly', but it doesn't for me. I have scoured the code but can't find any reason why it will call this error. Any ideas?

      function getRandomLabel():String {
      var labels:Array = new Array(”quote_01″, “quote_02″, “quote_03″,”quote_04″, “quote_05″, “quote_06″, “quote_07″);
      var index:Number = Math.floor(Math.random() * labels.length);
      return labels[index];

      but then I get this error in the output box:
      **Error** Scene=Scene 2, layer=actions, frame=1:Line 12: ‘{’ expected
      function getRandomLabel():String {

      **Error** Scene=Scene 2, layer=actions, frame=1:Line 16: Unexpected ‘}’ encountered

      what have i done wrong?