8 Replies Latest reply: Dec 30, 2012 5:24 AM by 龙宇 RSS

    ReferenceError: Error #1069: Property startTransmit not found on flash.net.NetStream and there is no

    BryBam Community Member

      I've played around with cirrus plenty of times before and have yet to see this error before. But now I cant get it to go away!

       

      "ReferenceError: Error #1069: Property startTransmit not found on flash.net.NetStream and there is no default value."

       

      My p2p Direct connect works great just fine. But every single time i see this error pop up. It throws an exception. I can't figure out where it's exactly happening.

       

      Has anyone encountered this before? Any ideas where I should look?

        • 1. Re: ReferenceError: Error #1069: Property startTransmit not found on flash.net.NetStream and there is no
          Michael Thornburgh Adobe Employee

          do you see it on the publisher side or the subscriber side? are you trying to pause or unpause the NetStream?

          • 2. Re: ReferenceError: Error #1069: Property startTransmit not found on flash.net.NetStream and there is no
            BryBam Community Member

            It looks like its happening on any side. I'm not pausing anything.

             

            Maybe it would be best to just post my code:

             

            I'm working on a "random matchmaking" for a game. But for the sake of doing some testing and getting things going, im working on setting up just a simple text chat to work on the cirrus part of the project. Then I was going to go from there. But i'm stuck on this now...

             

            Also, if it helps give some more context to what's going on here...I have another class that's not listed my mySQLdatabase helper class. Its just submitting the peerID to a MySQL table...so it can be randomly grabbed then connected to by other players. I have a timer updating the timestamp of that peer every 5 seconds...if they're still "looking"

             

            also, if you're wondering what the onlyallowedpeer string check about is incase...say i connect to someone...then when theyre sendstream is connectd then they will be automatically connecting back to me...then that makes sure its not someone else trying to connect to me.

             

            anyway...I'll post the main view code, then the cirrusHelper class:

             

            (sorry about the formatting it looks like the forum ruined it)

             

             

             

            --------------------

            --------------------

            --------------------

            Main Code:

            --------------------

            --------------------

            --------------------


                                          protected var cirrusFunctions:CirrusFunctions = new CirrusFunctions(confirmedConnectionFunction);

                                          protected var dBHelper:DataBaseHelper = new DataBaseHelper();

             

                                          protected var PKCount:int;

             

                                          protected var searchingTimer:Timer = new Timer(5000,0);

                                          protected var keepAliveTimer:Timer = new Timer(5000,0);

             

                                          protected var theChannel:String = "random";

             

                                          protected function view1_creationCompleteHandler(event:FlexEvent):void

                                          {

                                                    searchingTimer.addEventListener(TimerEvent.TIMER, searchingTimerFunction);

                                                    keepAliveTimer.addEventListener(TimerEvent.TIMER, keepAliveTimerFunction);

                                          }

             

                                          protected function backBtn_clickHandler(event:MouseEvent):void

                                          {

                                                    navigator.popView();

                                          }

             

             

             

              //connect disconnect / next btns

                                          protected function connectDisconnectBtn_clickHandler(event:MouseEvent):void

                                          {

                                                    if(FlexGlobals.topLevelApplication.uState == FlexGlobals.topLevelApplication.uStateDis)

                                                    {

              //connect and set the listener

                                                              cirrusFunctions.connectToNetConnection(netStatusHandler);

                                                              connectDisconnectBtn.enabled=false;

                                                              connectDisconnectBtn.label="CONNECTING...";

                                                    }

                                                    else

                                                    {

                                                              connectDisconnectBtn.enabled=false;

                                                              PKCount=0;

                                                              cirrusFunctions.onlyAllowedPeer=null;

                                                              searchingTimer.reset();

                                                              keepAliveTimer.reset();

                                                              cirrusFunctions.disconnect(true,true,true);

             

                                                    }

                                          }

             

             

             

             

              //cirrus status functions

                                          protected function netStatusHandler(event:NetStatusEvent):void

                                          {

              trace("before hitting switch check--"+event.info.code);

                                                    switch (event.info.code)

                                                    {

              //netCon EVENTS

              case "NetConnection.Connect.Closed" :

                                                                        trace(event.info.code);

                                                                        FlexGlobals.topLevelApplication.uState = FlexGlobals.topLevelApplication.uStateDis;

                                                                        connectDisconnectBtn.label="CONNECT";

                                                                        connectDisconnectBtn.enabled=true;

                                                                        break;

             

              case "NetConnection.Connect.Rejected" :

                                                                        trace(event.info.code);

                                                                        break;

             

              case "NetConnection.Connect.Failed" :

                                                                        trace(event.info.code);

                                                                        break;

             

              case "NetConnection.Connect.Success" :

                                                                        trace(event.info.code);

                                                                        cirrusFunctions.setupSendStream(netStatusHandler);

                                                                        connectDisconnectBtn.enabled=true;

                                                                        connectDisconnectBtn.label="DISCONNECT";

                                                                        break;

             

             

              //NETSTREAM EVENTS

              case "NetStream.Publish.Start" :

                                                                        trace(event.info.code);

              trace("begin Search");

                                                                        FlexGlobals.topLevelApplication.uState = FlexGlobals.topLevelApplication.uStateSearchingForPeer;

              trace("userState == userStateSearchingForPeer");

                                                                        dBHelper.pickRandomUser(gotRandomUserCallback);

                                                                        break;

             

              case "NetStream.Play.Start" :

                                                                        trace(event.info.code);

                                                                        searchingTimer.reset();

                                                                        keepAliveTimer.reset();

                                                                        break;

             

              case "NetStream.Play.Failed" :

                                                                        trace(event.info.code);

                                                                        resetAndTryAgain();

                                                                        break;

             

              case "NetStream.Play.Stop" :

                                                                        trace(event.info.code);

                                                                        resetAndTryAgain();

                                                                        break;

             

              case "NetStream.Connect.Closed" :

                                                                        trace(event.info.code);

                                                                        break;

             

              case "NetStream.Play.UnpublishNotify" :

                                                                        trace(event.info.code);

                                                                        break;

             

              case "NetStream.Unpublish.Success" :

                                                                        trace(event.info.code);

                                                                        break;

                                                    }

                                          }

             

                                          protected function resetAndTryAgain():void

                                          {

                                                    searchingTimer.reset();

                                                    keepAliveTimer.reset();

                                                    cirrusFunctions.disconnect(false,true,true);

                                                    cirrusFunctions.onlyAllowedPeer=null;

                                                    cirrusFunctions.setupSendStream(netStatusHandler);

              trace("resetAndTryAgain() - RAN");

                                          }

             

                                          protected function confirmedConnectionFunction():void

                                          {

              //this is triggered if both sides are connected to each other

              //this function is the result of a 2 second timer that is set off by the opposite side.

              trace("BOTH SIDES ARE CONNECTED AND LIFE IS GOOD!!");

             

                                          }

             

             

                                          protected function searchingTimerFunction(e:TimerEvent):void

                                          {

                                                    dBHelper.pickRandomUser(gotRandomUserCallback);

                                          }

             

                                          protected function gotRandomUserCallback(r:Object):void

                                          {

              //make sure got someone back, make sure it snot yourself

                                                    if(FlexGlobals.topLevelApplication.uState == FlexGlobals.topLevelApplication.uStateSearchingForPeer && r.serverInfo.initialData.length > 0 && r.serverInfo.initialData[0][1] != cirrusFunctions.netConnection.nearID)

                                                    {

                                                              FlexGlobals.topLevelApplication.uState = FlexGlobals.topLevelApplication.uStateTryingToCon;

              trace("GOT SOMEONE! - STOP TIMERS - TRY TO CONNECT P2P with: "+r.serverInfo.initialData[0][1]);

                                                              searchingTimer.reset();

                                                              keepAliveTimer.reset();

             

                                                              cirrusFunctions.setupReceiveStream(netStatusHandler,r.serverInfo.initialData[0][1]);

             

                                                    }

                                                    else if(!PKCount && FlexGlobals.topLevelApplication.uState == FlexGlobals.topLevelApplication.uStateSearchingForPeer)

                                                    {

                                                              if(cirrusFunctions.netConnection)

                                                              {

              trace("Coulnd't find someone - adding self to DB - Then keep looking");

                                                                        dBHelper.textMashsubmitUserTODB(cirrusFunctions.netConnection.nearID,FlexGlobals.top LevelApplication.userIP,submitToDBCallBackFunction);

                                                              }

                                                    }

                                                    else

                                                    {

              trace("Coulnd't find someone");

             

                                                              if(!keepAliveTimer.running)

                                                              {

              trace("keepAliveTimer started");

                                                                        keepAliveTimer.start();

                                                              }

             

                                                              if(!searchingTimer.running)

                                                              {

              trace("searchingTimer started");

                                                                        searchingTimer.start();

                                                              }

                                                    }

                                          }

             

                                          protected function submitToDBCallBackFunction(r:Object):void

                                          {

              //getting the primary key id of the row, so i can reference it to update the timestamp to keep this user as "active looking"

                                                    PKCount = int(r);

             

                                                    keepAliveTimer.start();

                                                    searchingTimer.start();

                                          }

             

                                          protected function keepAliveTimerFunction(e:TimerEvent):void

                                          {

                                                    dBHelper.textMashKeepaliveuer(PKCount);

                                          }

             

             

            --------------------

            --------------------

            --------------------

            Cirrus Helper Class:

            --------------------

            --------------------

            --------------------

             

             

            public class CirrusFunctions

                      {

             

                                protected const CirrusAddress:String = "rtmfp://p2p.rtmfp.net/";

                     protected const DeveloperKey:String = "mykey";

             

                                public var onlyAllowedPeer:String = null;

             

                                public var netConnection:NetConnection;

             

                                public var sendStream:NetStream;

                                public var receiveStream:NetStream;

             

                                protected var confirmSetupTimer:Timer = new Timer(2000,1);

                                protected var confirmSetupFunction:Function;

             

             

                                public function CirrusFunctions(CSF:Function)

                                {

                                          confirmSetupTimer.addEventListener(TimerEvent.TIMER_COMPLETE, endOfSetupConfirmTimer);

             

                                          confirmSetupFunction=CSF;

                                }

             

             

             

                                public function connectToNetConnection(callback:Function):void

                                {

              trace("Connecting to NetCon...");

                                          netConnection = new NetConnection();

                                          netConnection.addEventListener(NetStatusEvent.NET_STATUS, callback);

                                          netConnection.connect(CirrusAddress,DeveloperKey);

                                }

             

                                public function disconnect(nc:Boolean,ss:Boolean,rs:Boolean):void

                                {

              trace("Disconnecting...");

             

                                          if(ss)

                                          {

                                                    if(sendStream)

                                                    {

                                                              try {

                                                                        sendStream.close();

                                                              }catch(e:Error){

                                                                        trace(e);

                                                              }

                                                    }

                                                    sendStream=null;

                                          }

                                          if(rs)

                                          {

                                                    if(receiveStream)

                                                    {

                                                              try {

                                                                        receiveStream.close();

                                                              }catch(e:Error){

                                                                        trace(e);

                                                              }

                                                    }

                                                    receiveStream=null;

                                          }

                                          if(nc)

                                          {

                                                    if(netConnection)

                                                    {

                                                              try {

                                                                        netConnection.close();

                                                              }catch(e:Error){

                                                                        trace(e);

                                                              }

                                                    }

                                                    netConnection=null;

                                          }

             

                                          onlyAllowedPeer=null;

             

                                }

             

                                public function setupSendStream(netStatusCallback:Function):void

                                {

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

                                          sendStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusCallback);

             

                                          var c:Object = new Object;

                                          c.onPeerConnect = function(subscriber:NetStream):Boolean {

             

                                                    if(onlyAllowedPeer == null && receiveStream==null && FlexGlobals.topLevelApplication.uState == FlexGlobals.topLevelApplication.uStateSearchingForPeer)

                                                    {

                                                              FlexGlobals.topLevelApplication.uState = FlexGlobals.topLevelApplication.uStateTryingToCon;

             

                                                              confirmSetupTimer.reset();

                                                              confirmSetupTimer.start();

             

                                                              if(receiveStream == null)

                                                              {

                                                                        setupReceiveStream(netStatusCallback,subscriber.farID);

                                                              }

              trace("RETURNED TRUE - They connected to me first");

              return true;

                                                    }

                                                    else if(onlyAllowedPeer == subscriber.farID && receiveStream!=null && FlexGlobals.topLevelApplication.uState == FlexGlobals.topLevelApplication.uStateTryingToCon)

                                                    {

                                                              confirmSetupTimer.reset();

                                                              confirmSetupTimer.start();

             

                                                              if(receiveStream == null)

                                                              {

                                                                        setupReceiveStream(netStatusCallback,subscriber.farID);

                                                              }

              trace("RETURNED TRUE - onlyAllowedPeer");

              return true;

                                                    }

                                                    else

                                                    {

              trace("RETURNED FALSE");

              return false;

             

                                                    }

                                          };

             

                                          sendStream.client = c;

                                          sendStream.publish("testing12345");

              trace("SEND STREAM RAN");

                                }

             

                                public function setupReceiveStream(netStatusCallback:Function, theirID:String):void

                                {

                                          onlyAllowedPeer = theirID;

                                          FlexGlobals.topLevelApplication.uState = FlexGlobals.topLevelApplication.uStateTryingToCon;

             

                                          receiveStream = new NetStream(netConnection, theirID);

                                          receiveStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusCallback);

              //i also tried using "this" as client to see if it would get rid of the reference error. but no luck.

                                          receiveStream.client = new Object();

                                          receiveStream.play("testing12345");

             

             

             

              trace("setupReceiveStream RAN");

                                }

             

                                protected function endOfSetupConfirmTimer(evt:TimerEvent):void

                                {

                                          sendStream.send("receiveInfoOver");

                                }

             

                                public function receiveInfoOver():void

                                {

              //when both sides send a confirmation to another they send this function and then everything is good!

                                          confirmSetupFunction();

                                }

             

             

             

             

                      }


            • 3. Re: ReferenceError: Error #1069: Property startTransmit not found on flash.net.NetStream and there is no
              BryBam Community Member

              As you can see im not pausing anything. Any other potential ideas? Is there a way I could just try and contain these errors.

               

              I tried just making a startTransmit function with 2 arguments like this

               

              protected function startTransmit(one:*, two:*):void

              {

              trace(one, two)

              }

               

              and it actually ran that function and i saw a boolean, and a -1 get passed I cant remember right now if it was true or false.

               

              I still got the error though, it said it couldnt find the startTransmit property on my helper class.

              • 4. Re: ReferenceError: Error #1069: Property startTransmit not found on flash.net.NetStream and there is no
                madprocessor Community Member

                I have the same problem error on subscriber and publisher side, looks like it started with AIR 3.2.

                Is that possible? Maybe the new video pipeline?

                 

                Thanks

                 

                Joerg

                • 5. Re: ReferenceError: Error #1069: Property startTransmit not found on flash.net.NetStream and there is no
                  BryBam Community Member

                  Alright so, I think im understanding a little better what's happening.

                   

                  I'm on a Flex Android project. It seems to happen when I push the sleep button on the OTHER phone, then the one that's still awake gets a startTransmit or stopTransmit function depending if the other side is waking up or going to sleep.

                   

                  so, I just need to supress these crashes...I tried placing functions like this in my view...

                   

                  public function startTransmit($p1:*,$p2:*):void{

                    trace("startTransmit!");

                                                }

                   

                                                public function stopTransmit():void{

                    trace("stopTransmit!");

                                                }

                   

                  What's interesting is these work fine for the receivestream. but not the sendstream.

                   

                  I just put the functions in the view, then set the client to "this" for both sendStream, and receiveStream.

                   

                   

                   

                   

                  as another test, i tried something like:

                   

                  sendStream.client = new Object();

                  sendStream.client.startTransmit = startTransmit;

                  sendStream.client.stopTransmit = stopTransmit

                   

                   

                  and the same for the receiveStream. But again, it still only seems to be triggering my functions on the receiveStream. both clients have this setup.

                   

                  So, at least I know now this is happening when you press the sleep button. But i really wish i could suppress these errors. Any ideas?

                   

                   

                   

                   

                  (sorry i wish i could edit my post above but it wont let me. I've made the whole thing 10000 times more simple for the sake of the tests since i know what's going on now)

                  • 6. Re: ReferenceError: Error #1069: Property startTransmit not found on flash.net.NetStream and there is no
                    John O Moore Community Member

                    Did you ever find a solution to suppressing these errors?

                    • 7. Re: ReferenceError: Error #1069: Property startTransmit not found on flash.net.NetStream and there is no
                      Maslov22 Community Member

                      I have the exact same issue.  2 desktops connect fine, but when a phone is involved the startTransmit keeps getting called somewhere; everything crashes since it wont pin point a code line number and i have handlers for every imaginable thing already.