help on Action Script2 CS3 play differents movies on flv

  • jalexduran1
  • Newbie
  • Newbie
  • jalexduran1
  • Posts: 12

Post 3+ Months Ago

Hi:
I have 5 movies segments and I need a code to make it play automatic "after finish 1st segment start automatic second segment and consecutive same for all until 5th segment, then go to the 1st segment again at the end of the last segment, and repeating that loop forever...

sample: autoplay on "segment1.flv" at the end goto flv "segment2.flv"....
then "segment3.flv", then "segment4.flv", until "segment5.flv" then go and play the first flv "segment1.flv"

thanks

J Alex
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23455
  • Loc: Woodbridge VA

Post 3+ Months Ago

The FLV Playback component has that built in. See my post here
flash-forum/listeners-not-working-update-t57460.html#p305090

The tutorial for it is here
http://www.adobe.com/devnet/flash/artic ... print.html


Code: [ Select ]
import mx.video.*;
var listenerObject2:Object = new Object();
listenerObject2.stateChange = function(eventObject:Object):Void {
    trace(my_FLVPlybk.state);
};
my_FLVPlybk.addEventListener("stateChange", listenerObject2);
my_FLVPlybk.contentPath = "cuepointloop12.flv";
   // Set Videos Behavior
   
   // Create a videos object to hold a video
   // playlist and event handler functions...
   var videos:Object = new Object();
   
   // Set up to 7 video feeds in a single component
   videos.list = new Array();
   videos.list[0] = "cuepointloop12.flv";
   videos.list[1] = "";
   videos.list[2] = "";
   videos.list[3] = "";
   videos.list[4] = "";
   videos.list[5] = "";
   videos.list[6] = "";
   videos.loop = true;
   videos.length = 1;
   videos.loaded = false;
   
   
   // Path to FLVPlayback components
   var m = this.my_FLVPlybk;
   
   // Set the path of the first video feed
   m.contentPath = videos.list[0];
   
   // Set a 'ready' event handler to load the videos
   videos.ready = function( evt:Object ):Void
   {
      if(!this.loaded){
         this.loaded = true;
         for( var n=1; n<this.list.length; n++ ){
            if( videos.list[n].indexOf(".flv") != -1 ){
               m.activeVideoPlayerIndex = n;
               m.contentPath = videos.list[n];
               this.length++;
            }
         }
         m.activeVideoPlayerIndex = 0;
      }
   }
   m.addEventListener("ready",videos);
   
   // Set a 'complete' event handler to load the next video
   videos.complete = function( evt:Object ):Void
   {
     
      var nextIndex = Number(evt.vp)+1;
      if( nextIndex == this.length){
         if( this.loop ){
            nextIndex = 0;
         }else{
            return;
         }
      }
      m.activeVideoPlayerIndex = nextIndex;
      m.visibleVideoPlayerIndex = nextIndex;
      m.play();
   }
   m.addEventListener("complete",videos);
   
   // End Set Videos Behavior
         
  1. import mx.video.*;
  2. var listenerObject2:Object = new Object();
  3. listenerObject2.stateChange = function(eventObject:Object):Void {
  4.     trace(my_FLVPlybk.state);
  5. };
  6. my_FLVPlybk.addEventListener("stateChange", listenerObject2);
  7. my_FLVPlybk.contentPath = "cuepointloop12.flv";
  8.    // Set Videos Behavior
  9.    
  10.    // Create a videos object to hold a video
  11.    // playlist and event handler functions...
  12.    var videos:Object = new Object();
  13.    
  14.    // Set up to 7 video feeds in a single component
  15.    videos.list = new Array();
  16.    videos.list[0] = "cuepointloop12.flv";
  17.    videos.list[1] = "";
  18.    videos.list[2] = "";
  19.    videos.list[3] = "";
  20.    videos.list[4] = "";
  21.    videos.list[5] = "";
  22.    videos.list[6] = "";
  23.    videos.loop = true;
  24.    videos.length = 1;
  25.    videos.loaded = false;
  26.    
  27.    
  28.    // Path to FLVPlayback components
  29.    var m = this.my_FLVPlybk;
  30.    
  31.    // Set the path of the first video feed
  32.    m.contentPath = videos.list[0];
  33.    
  34.    // Set a 'ready' event handler to load the videos
  35.    videos.ready = function( evt:Object ):Void
  36.    {
  37.       if(!this.loaded){
  38.          this.loaded = true;
  39.          for( var n=1; n<this.list.length; n++ ){
  40.             if( videos.list[n].indexOf(".flv") != -1 ){
  41.                m.activeVideoPlayerIndex = n;
  42.                m.contentPath = videos.list[n];
  43.                this.length++;
  44.             }
  45.          }
  46.          m.activeVideoPlayerIndex = 0;
  47.       }
  48.    }
  49.    m.addEventListener("ready",videos);
  50.    
  51.    // Set a 'complete' event handler to load the next video
  52.    videos.complete = function( evt:Object ):Void
  53.    {
  54.      
  55.       var nextIndex = Number(evt.vp)+1;
  56.       if( nextIndex == this.length){
  57.          if( this.loop ){
  58.             nextIndex = 0;
  59.          }else{
  60.             return;
  61.          }
  62.       }
  63.       m.activeVideoPlayerIndex = nextIndex;
  64.       m.visibleVideoPlayerIndex = nextIndex;
  65.       m.play();
  66.    }
  67.    m.addEventListener("complete",videos);
  68.    
  69.    // End Set Videos Behavior
  70.          
  • jalexduran1
  • Newbie
  • Newbie
  • jalexduran1
  • Posts: 12

Post 3+ Months Ago

I upload the scripts to the 1st video , I do something wrong, let see

I have 5 videos named: segmento1.flv, segmento2.flv, segmento3.flv, segmento4.flv and segmento5.flv

this is the Web: http://www.losbayuncos.com

I also have 5 differents player, on the right if you click on 1st button on top segmento1.flv, load video1.swf, if you click on 2nd button below, will load segmento2.flv that play on video2.swf....and keep like that until last button, segmento5.flv, that play on video5.swf.....I place the code on each (swf) file video1.swf, video2.swf...until video5.swf...I also name the component on each *.swf file as my_FLVPlybk ....?? is not working, something is wrong, can you help me

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 18 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.