I download fms example from adobe site, it works fine that sucessfully
connected FMS server.but it didn't work that i wrote my codes followed
exmaple tutorial, it always reports "connect failed" .I can see connects
number was increased when i run my app in admin console.
   I wrote codes in Flex Builder, named HelloFms.mxml.But i wondering
whether i should write fla file,instead of mxml file ? The error
(NetConnection.Connect.Failed) does matter with this ?? how can i
establish my work environment ???
   here is my client-side codes:  helloFms.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
<mx:Script>
     <![CDATA[
     import flash.events.NetStatusEvent;
     import flash.events.SecurityErrorEvent;
     import flash.net.NetConnection;
     import flash.net.NetStream;
     import flash.events.Event;

         var nc :NetConnection;
         public function connection():void{
             if (Connect_btn.label == "Connect" ){
                nc.connect("rtmp:/tutorial_hello/room_01","test");
               nc.addEventListener(NetStatusEvent.NET_STATUS,
netStatusHandler);
               nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR,  
securityErrorHandler);
             }else{
                 nc.close();
             }

         }
           private function netStatusHandler(event:NetStatusEvent):void {
             var status :String = event.info.code;
             switch (status) {
                 case "NetConnection.Connect.Success":
                 /*     connectStream(); */
                     break;
                 case "NetStream.Play.StreamNotFound":
                     result.text = "Stream not found";
                     break;
             }
         }

         private function
securityErrorHandler(event:SecurityErrorEvent):void {
             result.text = "securityErrorHandler: " + event;
         }


     ]]>
</mx:Script>

     <mx:Button x="331" y="91" label="Connect" id="Connect_btn"
click="connection()"/>
     <mx:TextArea x="118" y="164" id="result"/>

</mx:Application>

here is server-side codes: main.asc
application.onConnect = function(p_client,text) {
       application.acceptConnection(p_client);
    //text handler
   }
Any help would be appreciate .


Reply via email to