Hello Im trying to do a lil something that gets the available cameras in a
broadcasting computer and puts em in a combo box. When the broadcaste changes
the combo box selection, the reciever should seamlessly stop seeing the first
cam and start with the new one.
I used an adobe script to start, currently if I were to switch camera Id have
to stop broadcasting(button), stop connection(button), select the camera and
press the connect button and the broadcast button again.
I tried to ad the code in the buttons so that when the broadcaster chooses
from the comboBox the connection/unbroadcasting and reconnection/broadcasting
is done automatically. When I do this, the receivers video stops but does not
update to the new video.

HERE IS THE CODE FOR THE BROADCASTER:
startstop_pb.enabled = false;

connect_pb.onRelease = function(){
if(this.label == "Connect"){
status_txt.text += "Connecting..." + newline;
this.label = "Disconnect";
nc.connect(rtmp_txt.text);
} else {
status_txt.text += "Disconnecting." + newline;
this.label = "Connect";
nc.close();
}
}

nc = new NetConnection();
nc.onStatus = function(info) {
status_txt.text += "NC.onStatus> info.code: " + info.code + newline;
if (info.code == "NetConnection.Connect.Success") {
status_txt.text += "Connected to " + this.uri + newline;
startstop_pb.enabled = true;
createNetStream(this);
}
}

createNetStream = function(nc){
ns = new NetStream(nc);
ns.onStatus = function(info) {
status_txt.text += "NS.onStatus> info.code: " + info.code + newline;
}
mycam = null;
mymic = null;
mycam = Camera.get(cameras_cb.selectedIndex);
mycam.setQuality(25600, 0);
mymic = Microphone.get();
mymic.setRate(11);
ns.attachVideo(mycam);
ns.attachAudio(mymic);
myvid.attachVideo(mycam);
}

startstop_pb.onRelease = function(){
if (this.label == "Start Broadcast"){
status_txt.text += "Starting broadcast" + newline;
this.label = "Stop Broadcast";
ns.publish(streamname_txt.text, "live");
} else {
status_txt.text += "Stopping broadcast" + newline;
this.label = "Start Broadcast";
myvid.attachVideo(null);
myvid.clear();
ns.close();
}
}

var mycam:Camera = Camera.get();
var myvid:Video;
myvid.attachVideo(mycam);
var camera_lbl:mx.controls.Label;
var cameras_cb:mx.controls.ComboBox;
camera_lbl.text = mycam.name;
cameras_cb.dataProvider = Camera.names;
function changeCamera():Void {
camera_lbl.text = mycam.name;

//stopping broadcast
status_txt.text += "Stopping broadcast" + newline;
this.label = "Start Broadcast";
myvid.attachVideo(null);
myvid.clear();
ns.close();
//disconnecting
status_txt.text += "Disconnecting." + newline;
this.label = "Connect";
nc.close();
//reconnecting
status_txt.text += "Connecting..." + newline;
this.label = "Disconnect";
nc.connect(rtmp_txt.text);
do{status_txt.text += "connecting" + newline;}
while(info.code == "NetConnection.Connect.Success");
//starting broadcast

status_txt.text += "Starting broadcast" + newline;
this.label = "Stop Broadcast";
ns.publish(streamname_txt.text, "live");

}
cameras_cb.addEventListener("change", changeCamera);
camera_lbl.setStyle("fontSize", 9);
cameras_cb.setStyle("fontSize", 9);

AND THE CODE FOR THE RECEIVER:
startstop_pb.enabled = false;

connect_pb.onRelease = function(){
if(this.label == "Connect"){
status_txt.text += "Connecting..." + newline;
this.label = "Disconnect";
nc.connect(rtmp_txt.text);
} else {
status_txt.text += "Disconnecting." + newline;
this.label = "Connect";
nc.close();
}
}

nc = new NetConnection();
nc.onStatus = function(info) {
status_txt.text += "NC.onStatus> info.code: " + info.code + newline;
if (info.code == "NetConnection.Connect.Success") {
status_txt.text = "Connected to " + this.uri + newline;
startstop_pb.enabled = true;
createNetStream(this);
}
}

createNetStream = function(nc){
ns = new NetStream(nc);
ns.onStatus = function(info) {
status_txt.text += "NS.onStatus> info.code: " + info.code + newline;
}
myvid.attachVideo(ns);
ns.play(streamname_txt.text, -1)
}

I read somewhere about a reset function. Please help me out here I will
appreciate it a lot :)