Hello again John,
i wrote an as2 simple code wich i think you will find helpful  

import mx.utils.Delegate;

var nc:NetConnection = new NetConnection();

nc.connect(null);

var streams:Array = new Array();

streams.push("video1.flv");

streams.push("video.flv");

streams.push("video2.flv");

streams.push("video3.flv");

streams.push("video.flv");

streams.push("video.flv");

streams.push("video4.flv");

streams.push("video5.flv");

var ns2:NetStream;

var actualStream = 0;

var listStreams:Array = new Array();

this.newStream(streams[actualStream]);

function newStream(sName){

    trace("Checking..." + sName);

    ns2 = new NetStream(this.nc);

    ns2.play(sName);

    ns2.onStatus = Delegate.create (this, checkStream);

}

function checkStream(info){

     trace(info.code);

     if (info.code != "NetStream.Play.StreamNotFound") {

        trace("exists");

        this.onStatus = null;

        ns2.close();

        this.listStreams.push(streams[actualStream]);

        this.nextStream();

     }else{ 

        trace("no exists");

        this.onStatus = null;

        ns2.close();

        this.nextStream();

     }

}

function nextStream(){

    this.actualStream++;

    if(this.actualStream < this.streams.length){

        trace("go to next...");

        this.newStream(this.streams[this.actualStream]);

    }else{

        trace("Finish");

        this.viewListStream();

    }

}

function viewListStream(){

    trace("Lista:");

    for(var i=0 ; i<this.listStreams.length ;i++ ){

        trace("> " + this.listStreams[i]);

    }

}







John Gorman escribió:
> First let me think you all for answering all the questions on this list. 
> Many of the replies have been helpful to me so far.
>
> I am working with a customized version of oflaDemo. I have archived 
> .flv's and also live streams that I would like to be able to display and 
> play. I have no experience with Java, so I do everything with 
> ActionScript in Flash. I am trying to write a function that will check 
> if a live stream exists, and eventually put the stream name into a 
> datagrid like the one in the demo.
>
> Here is what I have so far:
>
> function liveCheck() {
>     for(var i:Number = 1; i < 11; i++) {
>         sName = loadedvar.path + i;
>        
>         this.ns2 = new NetStream(this.nc);
>         ns2.setBufferTime(1);
>         ns2.play(sName, -1);
>        
>         if (ns2.bytesLoaded != undefined) {
>             // stream exists
>         }
>     }
> }
>
> setInterval(liveCheck, 30000);
>
> sName is the name of the stream, which is read in from an external file 
> and a number ranging from 1-10 is concatenated to the end of it. 
> Unfortunately, this method does not detect live streams that exist.
>
> Any help would be appreciated. I look forward to your suggestions.
>
> _______________________________________________
> osflash mailing list
> [email protected]
> http://osflash.org/mailman/listinfo/osflash_osflash.org
>   


_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to