3 Replies Latest reply on Feb 20, 2010 5:35 PM by suxuekun

    Still Stratus connection problem

    satheeshpallath12

      <?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 mx.controls.Alert;

              private const StratusAddress:String = "rtmfp://stratus.adobe.com";
              private const DeveloperKey:String =
      "4423df5893dcbe33c8e5fe75-e866dfa19977";
              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");                   //ERROR AT THIS LINE
              }

              ]]>
          </mx:Script>
          <mx:Button x="335" y="238" label="Connect" click="connect()" id="conn"/>


      </mx:Application>

       

      error: 1119: Access of possibly undefined property nearID through a reference with static type flash.net:NetConnection.    connection/src    connection.mxml    line 27    1265365843918    87

        • 2. Re: Still Stratus connection problem
          satheeshpallath12 Level 1

          Hai suxue,

           

          Here is my code.I tried your code but not getting the stratus

          connection.Once i got Netconnection.Success can u reply?

           

          Advanced Thanx

           

          <?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 = "Developers ID";

          private var nc:NetConnection;

          private var sendStream:NetStream;

          private var recvStream:NetStream;

          private var txt:String;

          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);

          //txt = nc.nearID;

          //Alert.show(nc.nearID);

          Alert.show("hello,hello");

          }

           

          sendStream = new NetStream(nc,NetStream.DIRECT_CONNECTIONS);

           

          sendStream.addEventListener(NetStatusEvent.NET_STATUS,netStreamHandler);

          private function getconnect(id:String):void

          {

          recvStream = new NetStream(nc,id);

          recvStream.addEventListener(NetStatusEvent.NET_STATUS, netStreamHandler);

          }

          ]]>

          </mx:Script>

          <mx:TextArea x="118" y="62" height="25" width="116"/>

          <mx:Text x="80" y="63" text="Text" id="text1"/>

          </mx:Application>

           

           

          ERRORS:

          -> 1119: Access of possibly undefined property DIRECT_CONNECTIONS through a

          reference with static type Class. stratus/src stratus.mxml line 34

          1265962992989 19

           

          ->1120: Access of undefined property nc. stratus/src stratus.mxml line 34

          1265962992973 17

           

          ->1120: Access of undefined property netStreamHandler. stratus/src

          stratus.mxml line 36 1265962992989 21

           

          ->1120: Access of undefined property netStreamHandler. stratus/src

          stratus.mxml line 40 1265962992989 23

           

          ->1120: Access of undefined property sendStream. stratus/src stratus.mxml

          line 34 1265962992973 16

           

           

          ->1137: Incorrect number of arguments. Expected no more than 1. stratus/src

          stratus.mxml line 34 1265962992973 18

          • 3. Re: Still Stratus connection problem
            suxuekun Level 1

            sorry for late reply

            I am chinese and have Spring Festival these days.

             

            you need playerglobal.swc for 10.0 or 10.1 but not for 9.0.