0 Replies Latest reply on Jun 29, 2007 12:05 AM by chicksel

    Loop FLV Array

    chicksel
      Hello

      I have the following script to load multiple FLV files in an array and to play them random...The problem is that im not able to loop the array...

      The script:

      my_FLVPlybk.muteButton = mute;

      var movies:Array = ["filmpje1.flv","test.flv","filmpje3.flv"];
      var tempMovies:Array = movies.concat();
      var lastMovie:String = "";

      function getMovie():String
      {
      if(tempMovies.length==0){
      tempMovies = movies.concat();
      trace("--------LEEG-----------");
      }
      var movie:String = tempMovies.splice(Math.floor(Math.random()*tempMovies.length),1).toString();
      if(lastMovie==movie){
      tempMovies.push(movie);
      return getMovie();
      } else {
      lastMovie=movie;
      }
      return movie;
      }

      onEnterFrame = function(){
      trace(getMovie());
      }

      var listenerObject:Object = new Object();
      listenerObject.complete = function(eventObject:Object) {
      my_FLVPlybk.play(getMovie());
      }

      my_FLVPlybk.addEventListener("complete", listenerObject);
      my_FLVPlybk.play(getMovie());

      What do i have to add to loop the files??

      And does anyone know how to rewrite the script so that i can load the FLV files from an XML file?

      Thanks.

      Grtz Amanda