FMS save stream in FMS directory

Hey
Figured it was about time i learned FMS and already i have gotten myself into quite a mess.
What i’m trying to do is record video and audio and store it on my FMS.

I can see my client conneced to the server. I can see the bandwidth going up and i can see the stream in the Administration Console. However, when I close the stream, nothing is saved.
Could someone point me in the right direction?

What my console looks like and my code:
(the name set in publish is Math.random(), hence the funny name)
EDIT: sorry for the messy code, the form messed up everything.


private var $start:Sprite;       
private var $stop:Sprite;                
private var $nc:NetConnection;       
private var $ns:NetStream;                

public function Main() {            
this.stage.scaleMode = StageScaleMode.NO_SCALE;                  this.stage.align = StageAlign.TOP_LEFT;                       
this.$nc = new NetConnection();                        this.$nc.addEventListener(NetStatusEvent.NET_STATUS,onConnectionStatus);           
this.$nc.connect("rtmp://localhost:1935/RecordStream/");        
}
private function onConnectionStatus(e : NetStatusEvent) : void {
if(!this.$nc.connected) return;                        
this.$start = new Sprite();           
this.$start.graphics.beginFill(0x00ff00);
this.$start.graphics.drawRect(0, 0, 40, 20);           
this.$start.graphics.endFill();            
this.$start.addEventListener(MouseEvent.CLICK, this.onStart)           
this.addChild(this.$start);                        
this.$stop = new Sprite();            
this.$stop.graphics.beginFill(0xff0000);            
this.$stop.graphics.drawRect(40, 0, 40, 20);            
this.$stop.graphics.endFill();            
this.$stop.addEventListener(MouseEvent.CLICK, this.onStop);        
this.addChild(this.$stop);                       
this.$ns = new NetStream(this.$nc);            
this.$ns.addEventListener(NetStatusEvent.NET_STATUS, this.onStreamStatus);

var mic:Microphone = Microphone.getMicrophone();            
var cam:Camera = Camera.getCamera();            
this.$ns.attachAudio(mic);            
this.$ns.attachCamera(cam);                
}
private function onStreamStatus(e : NetStatusEvent) : void {            
trace(e.info.code);        
}
private function onStart(e : MouseEvent) : void {
trace(" - start");            
this.$ns.publish((Math.random().toString()), "record");        
}        
private function onStop(e : MouseEvent) : void {            
trace(" - stop");            
this.$ns.close();        
}