Microphone drop-down selection doesn't work

I have written my own chat software, and while the webcam selection (in settings) works, when I select different microphones, although they appear in the selection box as if they have changed, the same microphone that was on before, remains on. The volume works fine.

I have tried the same computer using professional chat software, and the microphone selection works, so it is not the computer.

Don’t think it can be this code:

if (micro!== null) {
micro.addEventListener(StatusEvent.STATUS,micropho neStatusHandler);
nsPublish.attachAudio(microphone);
}

function microphoneStatusHandler(event:StatusEvent):void {
if (event.code == “Microphone.Unmuted”) {
//default rate is 8 Mhz
microphone.rate=11;
} else {
//I have blocked my microphone - same as no mike
}
}

However, as I said, on the professional software the microphone selection worked - any suggestions how they do it? Bit stuck…

Thanks

Alan Costello