# \[Q\] FMS2 + AS3 NetStream Publish not working?

**URL:** <https://forum.kirupa.com/t/q-fms2-as3-netstream-publish-not-working/233952>\
**Category:** Uncategorized\
**Created:** [July 28, 2007, 5:32pm UTC](https://forum.kirupa.com/t/q-fms2-as3-netstream-publish-not-working/233952 "2007-07-28T17:32:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![manfree](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@manfree](https://forum.kirupa.com/u/manfree)\
**Post date:** [July 28, 2007, 5:32pm UTC](https://forum.kirupa.com/t/q-fms2-as3-netstream-publish-not-working/233952/1 "2007-07-28T17:32:56Z")

</div>

Dear all

I am trying to create a simple online recording via FMS2

Here is my coding:

```auto
 
NetConnection.defaultObjectEncoding = ObjectEncoding.AMF0;
var nc:NetConnection = new NetConnection();
var ns:NetStream;
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
nc.connect("rtmp://localhost/test"); 
 
btnRec.addEventListener(MouseEvent.CLICK, clickRecord);
btnStop.addEventListener(MouseEvent.CLICK, clickStop);
btnStop.enabled = false;
 
function netStatusHandler(e:NetStatusEvent):void {
  if (e.info.code == "NetConnection.Connect.Success") {
    trace("Connect success");
    getCamera();
    ns = new NetStream(nc); 
 }
}
function getCamera():void {
   var cam:Camera = Camera.getCamera();
   if (cam != null) {
      var video:Video = new Video(320,240);
      video.attachCamera(cam);
      addChild(video);
   }
} 
function clickRecord(e:MouseEvent):void {
 btnRec.enabled = false;
 btnStop.enabled = true;
 ns.publish("videoName","record");
}
 
function clickStop(e:MouseEvent):void {
 btnRec.enabled = true;
 btnStop.enabled = false;
 ns.publish("false");
 nc.close(); 
}

```

WHen I try to record a video via my cam (click the button “btnRec”), … no error message comes up,  
but there is no FLV file (it should be “videoName.flv”) has been generated in rtmp://localhost/test ???  
Do I miss anything or do something wrong in the script ???

Please help ~~  
THanks ~~
