1 Reply Latest reply on Feb 14, 2007 3:38 AM by TheOutlander

    My application can not connect to FMS2

      My application can not connect to FMS2

      hi,all, Some things block me. Who can you help me? I appreciate your support.

      Server: FMS 2.0

      Client : Flash 8 ,Flex 2.0.1

      I find Flash 8 code is fine. It can connect to FMS2 with on error. I can find connect show in FMS console.

      But I find AS3 codes can not connect to FMS2. Why? I am very puzzle...:-(
      Error messages is nse.info.code:NetConnection.Connect.Failed nse.info.level:error...help me please..Thank you very much.

      My codes below.

      ==========Flash 8 code =========
      // Open connection to FlashCom
      client_nc = new NetConnection();
      // Handle status message
      client_nc.onStatus = function(info) {
      trace("Level: " + info.level + newline + "Code: " + info.code);
      // Initialize the typing stage
      TypingStage.text = "";
      // Create a remote shared object. client_nc.uri is the URI of the
      // NetConnection the shared object will use to connect to the
      // server. I.e., the one just created.
      text_so = SharedObject.getRemote("sharedtext", client_nc.uri, false);
      // The following is very important, nothing happens otherwise
      // Each time something changes in the shared object, the server
      // sends out a synchronization message. This onSync handler
      // updates the movie based on the information.
      text_so.onSync = function(list) {

      // Update the textArea in the typing stage with the latest
      // text from the shared object. The 'for' loop condition searches
      // through the list of changes, and the 'if' condition ensures
      // that we apply the relevant change only if someone other than
      // this client has changed the value.
      for ( var i = 0; i < list.length; i++ )
      if ( list.name == "textValue" && list.code != "success")
      TypingStage.text = text_so.data.textValue;
      // Update the shared object every time the user types in new text
      TypingStage.onChanged = function()
      text_so.data.textValue = TypingStage.text;
      ===============Flex2 代码如下====================
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creati>
      import flash.net.*;
      import mx.controls.Alert;
      import flash.events.SyncEvent;

      private var client_nc:NetConnection;
      private var text_so:SharedObject;

      public function init():void

      rte.text = "";

      public function ioEvent(ioe:IOErrorEvent):void
      rte.text = rte.text+"/n"+" io:"+ioe.text;

      public function connectStatus(nse:NetStatusEvent):void
      //trace("Level: " + nse.info);
      rte.text = rte.text+"/n"+" nse.info.code:"+nse.info.code+" nse.info.level:"+nse.info.level;

      public function click():void
      client_nc = new NetConnection();
      client_nc.addEventListener(NetStatusEvent.NET_STATUS ,connectStatus);
      rte.text = "connect rtmp:// ";
      client_nc.connect("rtmp://"); ///tutorial_text

      text_so = SharedObject.getRemote("sharedtext", client_nc.uri, false);

      public function syncShareObject(se:SyncEvent ):void
      var list:Array = se.changeList;
      var i:int;
      for (i = 0; i < list.length; i++ ){
      if ( list.name == "textValue" && list.code != "success"){
      rte.text = text_so.data.textValue;

      public function changeRTE():void
      text_so.data.textValue = rte.text;

      public function disconnect():void{
      if (client_nc.connected){

      <mx:RichTextEditor id="rte" x="23" y="19" width="626" height="337" cornerRadius="20" change="changeRTE()">
      <mx:Button x="105" y="381" label="Start Connection" width="204" click="click()"/>
      <mx:Button x="317" y="381" label="Disconnect" width="209" click="disconnect()"/>

        • 1. Re: My application can not connect to FMS2
          Action Script uses AMF3 format to communicate. However, Flash Media Server 2 only understands the AMF0 format.....

          Do the following:
          var client_nc:NetConnection = new NetConnection();
          client_nc.objectEncoding = flash.net.ObjectEncoding.AMF0;

          This should connect .... however, you might run into other issues like me... I am having issues with NetStream after that ... however, let me know if this works ...