1 Reply Latest reply on Feb 18, 2010 10:20 AM by Michael Thornburgh

    Problem with net connection

    jananikrishna

      Hi everybody

      I am facing a problem with this code . the alert message  I get is NetConnection.Connect.Failed

      Please check this code and respond to me immediately as this is very urgent

       

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
      creationComplete="connect()">

       

          <mx:Script>
              <![CDATA[
              import flash.events.NetStatusEvent;
              import flash.net.NetConnection;
              import flash.net.NetStream;
              import mx.controls.Alert;

       

              private const StratusAddress:String = "rtmfp://stratus.adobe.com";
              private const DeveloperKey:String ="my developer key";
              private var nc : NetConnection;
            
             
             
              private function connect():void
              {
                  nc = new NetConnection();
                  nc.addEventListener(NetStatusEvent.NET_STATUS,netConnectionHandler);
                  nc.connect(StratusAddress + DeveloperKey);
              }

       

              private function netConnectionHandler(event:NetStatusEvent):void
              {
                 
                 Alert.show(event.info.code,"infocode");
                 Alert.show(nc.nearID,"peerid"); 
                               
              }

       

              ]]>
          </mx:Script>

      </mx:Application>

       

       

      Advance thanks

        • 1. Re: Problem with net connection
          Michael Thornburgh Adobe Employee

          two things (potentially) wrong with this code.  thing #1: there must be a "/" between "rtmfp://stratus.adobe.com" and your developer key.  #2: presumably you are actually using your real Stratus developer key and not literally "my developer key" for DeveloperKey.  if that's the case, then just add a trailing slash to the StratusAddress string.  or change the nc.connect line to read

           

             nc.connect(StratusAddress + "/" + DeveloperKey);

           

          -mike