4 Replies Latest reply on Jun 10, 2007 8:00 AM by kglad

    Change "sub movie" Variable

    Yue_Hong Level 1
      How to change the variable in "sub movie" from main movie? For example, my main movie load the sub movie with " xyz.loadMovie("multiArray.swf");". Inside multiArray.swf, there is a variable called "abc". How can I change the value in that variable from the main movie?
        • 1. Re: Change "sub movie" Variable
          kglad Adobe Community Professional & MVP
          after loading is complete:

          • 2. Re: Change "sub movie" Variable
            Yue_Hong Level 1
            Thanks for your reply. But how can I build the function to make sure the loading is complete before set the variable? A simple working example code pls...
            • 3. Re: Change "sub movie" Variable
              Yue_Hong Level 1
              Here is my working code that I have been working on for the whole day, but still can't get it work...

              for (i=1;i<=12;i++){
              this["PhotoLoader"+i]._visible= false;
              PhotoPath="/images/activity photo/Smart School Training/";
              _global.loadPicture = Array();
              _global.loadPicture.push(new Array("1.jpg","800","600","h"));
              _global.loadPicture.push(new Array("2.jpg", "800","600","h"));
              _global.loadPicture.push(new Array("100_2996.jpg", "1632","1232","h"));
              _global.loadPicture.push(new Array("100_2997.jpg", "1632","1232","h"));
              _global.loadPicture.push(new Array("100_2998.jpg", "1632","1232","h"));
              _global.loadPicture.push(new Array("100_4586.jpg", "1632","1232","h"));
              _global.loadPicture.push(new Array("100_4587.jpg", "1632","1232","h"));
              _global.loadPicture.push(new Array("100_4591.jpg", "1632","1232","h"));

              for (i=1;i<=_global.loadPicture.length;i++){
              this["PhotoLoader"+i]._visible= true;
              this["PhotoLoader"+i].loadPhoto = PhotoPath + _global.loadPicture[i-1][0];
              • 4. Re: Change &quot;sub movie&quot; Variable
                kglad Adobe Community Professional & MVP
                if you use loadMovie() you must use preloader code. ie, you need to use a loop (setInterval, for example) to repeatedly compare your targets' bytesLoaded() and bytesTotal(). when they match loading is complete.

                because you're loading several swfs simultaneously, it would be easier for you to use the moviecliploader class and its onLoadInit() method to determine when you're ready to access variables in the loaded swfs first frame.

                p.s. you should use the prefix _global only when assigning loadPicture, NOT when applying a method or reading a property.