A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: netConnection status detection?

  1. #1
    Retarded User
    Join Date
    Nov 2005
    Location
    New Zealand
    Posts
    28

    netConnection status detection?

    Hi

    I'm trying to detect if i lose a connection to my stream. I'm connecting to vital stream.

    I need to hold the connection open for a longtime so when i try and play a stream the connection somtimes has been broken. How can i detect if the connection is droped.

    I've tried unsing the nc.onStatus event but i cant get it to fire when i force a connection to drop (by pulling the network cable).

    A way to check the netConection before i play a stream is all i really need.

    something like this:

    if(nc.connected == true){
    //play my stream
    }else{
    //repair my connection and then try playing
    }

    Anyhelp would be awsome!

    Andrew

  2. #2
    FK Slacker
    Join Date
    Jun 2000
    Location
    vancouver
    Posts
    3,208
    NetConnection.connect() returns true or false depending on whether the connection succeeded - so you could use that:
    code:

    nc=new NetConnection();
    var connected=nc.connect(null);
    if(connected){
    //play stream
    }
    else{
    // show error
    }


    K.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center