all groups > macromedia flash flashcom > september 2006 >
You're in the

macromedia flash flashcom

group:

Attach NetStream to Duplicated MovideClip on the fly


Attach NetStream to Duplicated MovideClip on the fly ladue
9/4/2006 1:02:53 AM
macromedia flash flashcom:
Hi,

Thanks for looking at this.

I am trying to play diferent segments of a movie.flv looped in duplicated
MovieCLips. However, only the first MovieClip loads the video, and the rest of
duplicated MovieCLips are created but without the flv. here is the code:

// Create the NetConnection object, and connect to the FlashComm
// application on the server.
var nc = new NetConnection( );
nc.connect("rtmp://localhost/surveillance");

//number of times looping
j=6;
count = 0;
//starting point for the video
starting=0;

//duplicate MovieClip that plays the Video
while (count<=j) {
this.one.duplicateMovieClip("one"+count, count);
var ns = new NetStream(nc);
this["one"+count].Mymov.attachVideo(ns);
ns.play("security4","starting",10);

//once done play it again
ns.onStatus=function(info:Object){
if(info.code == "NetStream.Play.Stop"){
ns.seek(0);
}
}
count += 1;
starting +=3;
}

I would appreciate any help. THanks.

Re: Attach NetStream to Duplicated MovideClip on the fly ladue
9/4/2006 4:17:33 PM
here is a way to do it:


my_nc = new NetConnection();
my_nc.connect("rtmp://localhost/surveillance");

for (var i:Number = 0; i < 15; i++){
j=i*10;
_root["my_ns"+i] = new NetStream(my_nc);
_root.attachMovie("video_container", "vid"+i, (i+1));
_root["vid"+i]._y = 40*i;
_root["vid"+i].rt.maVideo.attachVideo(_root["my_ns"+i]);
_root["my_ns"+i].play("security",j,10);

//loop the stream

_root["my_ns"+i].onStatus=function(info:Object){
if(info.code == "NetStream.Play.Stop"){
_root["my_ns"+i].seek(0);
}
}

}

The stream is supposed to loop, but it doesn't. Does anyone knows how to make
it loop?
THanks again.
AddThis Social Bookmark Button