5 Replies Latest reply on Feb 15, 2007 3:16 PM by z3b3dy

    flash SWF rotator - how do i play swf's in order

    downsound
      I have a simple task thats taking way too long.

      I have a few swf movies that are going to play on a billboard like stage, one after another, for example, this application could be an swf ad rotator....

      questions:
      1.) how do i know when the first swf is over?
      I guess i could watch the frames, but isn't there a simple way (in actionscript) to play say a list of urls like

      /*
      http://mysite.com/1.swf
      http://mysite.com/2.swf
      http://mysite.com/3.swf
      http://mysite.com/4.swf
      */
      //ok so put them in an array,

      var myArray:Array = new Array();
      myArray.push(" http://mysite.com/1.swf");
      myArray.push(" http://mysite.com/2.swf");
      myArray.push(" http://mysite.com/3.swf");
      myArray.push(" http://mysite.com/4.swf");

      trace(myArray); // one,two,three, four

      //now why cant i load the first one

      var mc:MovieClip = this.createEmptyMovieClip("mc", 2);
      var billboard:MovieClip = mc.createEmptyMovieClip("billboard", mc.getNextHighestDepth());
      billboard.loadMovie(myArray[0]); // first swf
      billboard._x = 0;
      billboard._y = 0;

      /* so far so good, except the first swf loops
      why can't i just do this logically

      load the first movie
      read the length of frames of the loaded movie
      say half way thru the playing of the first movie, load the next
      when the first movie is finished, play the next

      */

      the key is how do I check to see if the first swf is finished?
      use a frame watcher function?


      any help would be way cool

      rick oneil
      kingston, jamaica

        • 1. Re: flash SWF rotator - how do i play swf's in order
          kglad Adobe Community Professional & MVP
          either start a loop that continually checks the _currentframe of the first swf, define a watch() function to check the _current of the first swf or define a variable or call a function on the last frame of your first swf.
          • 2. Re: flash SWF rotator - how do i play swf's in order
            downsound Level 1
            so in writing the loop to check the total frames and current frame, i'm getting infor for the parent movie, not the loaded swf movie

            ie.
            /*creating the movieClip like this


            var mc:MovieClip = this.createEmptyMovieClip("mc", 2);
            var billboard:MovieClip = mc.createEmptyMovieClip("billboard", mc.getNextHighestDepth());
            billboard.loadMovie(myArray[0]); // first swf
            billboard._x = 0;
            billboard._y = 0;

            /* then to get the properties of that movie i'm doing this

            trace ("billboard._totalframes : " + billboard._totalframes);
            trace ("billboard._totalframes : " + billboard._totalframes);

            but in the output window i get the properties of the parent (calling) movie....


            • 3. Re: flash SWF rotator - how do i play swf's in order
              kglad Adobe Community Professional & MVP
              i'm not sure why your duplicating that trace statement but that will display the _totalframes of you external swf WHEN loading is initiated.

              you should use preloader code or the onLoadStart() method of the moviecliploader class' listener.
              • 4. Re: flash SWF rotator - how do i play swf's in order
                downsound Level 1
                that was typo, i'm a bit farther...

                in the code , the output window shows the first billboard swf frames ticking down to the end.

                questions:

                1.) the second movie plays but i cant seem to test the current frame?
                2.) how can i loop in a different way, at will say in a finction to test the movie location?

                there must be an easier way to do the following:

                obtain the url list, for now I'll just populate the array,
                eventually code a recordset to feed the urls dynamically.

                load and play the frst swf from frame 2 (frame i is the stopped state in the loaded swf's)

                while the first is playing, start loading the second, in another mc
                when the first swf is finished (ie. _currentframe == _totalframes)
                play the next same way and repeat untill the last swf in the array
                then loop the playback to the top ( ie if say a loop parameter is true).
                to play the entire list again.....


                • 5. Re: flash SWF rotator - how do i play swf's in order
                  z3b3dy
                  Out of interest did you get any further with this problem? I'm having the same issue and am not getting much further.