0 Replies Latest reply on Jan 21, 2010 10:13 AM by AriAmiri

    translating AS2 to AS3

    AriAmiri

      Hi.

       

      Below I have a bit of code that determines the bandwidth that a user has.  It is written in ActionScript 2.  The problem is that I am unfamiliar with AS2, and I wanted to use this in conjunction with a live streaming video player built in AS3.  I was wondering if anyone could give me the equivalent code in AS3, or if there's any way to tell flash that a portion of the code will be written in AS2.

       

      Thank You,


      Ari Amiri

       

      nc = new NetConnection();
      nc.onStatus = function(info) {
          trace("Level: "+info.level+" Code: "+info.code);
          if (info.code == "NetConnection.Connect.Success") {
              trace("--- connected to: " + this.uri);
          }
      };

      nc.onBWDone = function(kbitDown, deltaDown, deltaTime, latency) {
          trace("onBWDone: kbitDown:"+kbitDown+" deltaDown:"+deltaDown+" deltaTime:"+deltaTime+" latency:"+latency);

          // app logic based on the bandwidth detected follows here
          detected_bw = kbitDown;
          // close the Netconnection to bwcheck
          this.close();
      }

      nc.onBWCheck = function() {
          trace("onBWCheck");
          return ++counter; // Serverside, just ignore any return value, For now return the call count
      }

      nc.connect("rtmp://216.18.231.42/bwcheck", true);
      stop();