Publish a Camera and Microphone

Listing E.3 publishes your camera and microphone to a NetConnection. The connection script uses the UI components technique from Listings E.1 and E.2.

Listing E.3 Flash ActionScript for Publishing a Camera and Microphone
nc = new NetConnection();
nc.onStatus = function(info) {
      trace("LEVEL: "+info.level+"  CODE: "+info.code);
      if (info.code == "NetConnection.Connect.Success") {
            // Call a function to setup the NetStream Publish when the server accepts the 
startStreamPublish = function () {
      // attach the Camera feed to an Embedded Video Object named, "my_video"
      // that exists on the Flash Stage.
      // attach a NetStream to the variable, publish_ns
      publish_ns = new NetStream(nc);
      // attach the Microphone and Camera to the publish_ns stream
      // start publishing the combined camera and microphone feed

nc.connect("rtmp://myApplication/myInstance", "Tracey Legault-Davis", "Bert");

The SSAS ActionScript template in Listing E.2 can be used with this ActionScript.

    Part I: 10 Quick Steps for Getting Started