5 Replies Latest reply on Aug 18, 2007 11:57 PM by Jay1347

    LoadVariable - Undefined

    Jay1347
      I'm trying to randomly load images, but I get undefined message when I want to load a variable from a number.txt.
      All files are in the same directory.

      I tried to set a global variable, but no success.

      Your help would be appreciated.

      Thanks a bunch,



      Code of the main swf containing 16 swf files:

      _root.box1.loadMovie("/flash/mosaic2/box1.swf");
      _root.box2.loadMovie("/flash/mosaic2/box2.swf");
      _root.box3.loadMovie("/flash/mosaic2/box3.swf");
      _root.box4.loadMovie("/flash/mosaic2/box4.swf");
      _root.box5.loadMovie("/flash/mosaic2/box5.swf");
      _root.box6.loadMovie("/flash/mosaic2/box6.swf");
      _root.box7.loadMovie("/flash/mosaic2/box7.swf");
      _root.box8.loadMovie("/flash/mosaic2/box8.swf");
      _root.box9.loadMovie("/flash/mosaic2/box9.swf");
      _root.box10.loadMovie("/flash/mosaic2/box10.swf");
      _root.box11.loadMovie("/flash/mosaic2/box11.swf");
      _root.box12.loadMovie("/flash/mosaic2/box12.swf");
      _root.box13.loadMovie("/flash/mosaic2/box13.swf");
      _root.box14.loadMovie("/flash/mosaic2/box14.swf");
      _root.box15.loadMovie("/flash/mosaic2/box15.swf");
      _root.box16.loadMovie("/flash/mosaic2/box16.swf");


      Code for one of the above mentioned swf files, box1:

      _root.box1.main.loadVariables("/flash/mosaic2/number.txt");
      _root.box1.main.number=Number(_root.box1.main.number);

      //
      number is the total number of the pictures
      //

      var i = random(Number(_root.box1.main.number))+1;
      _root.box1.main.loadMovie("/flash/mosaic2/"+i+".jpg");

      myInterval = setInterval(Random, 5000);

      function Random() {
      var j = random(Number(_root.box1.main.number))+1;
      _root.box1.main.loadMovie(("/flash/mosaic2/"+j+".jpg"));
      import mx.transitions.*;
      import mx.transitions.easing.*;
      TransitionManager.start(_root.box1.main, {type:Photo, direction:Transition.IN, duration:1});
      }