1 Reply Latest reply on Jun 11, 2009 8:53 AM by kglad

    new LoadVars() Working to a point???

    DazFaz Level 1

      Hi everyone,

       

      Im having a small problem with a connection class Im trying to create:

       

      class checkForInternetConnection {
      public var myConnection:LoadVars;
      public function checkForInternetConnection(domainToCheckForConnection:String) {
        myConnection = new LoadVars();
        myConnection.onLoad = function(success:Boolean) {
         if (success) {
          return true//<<----------------------------------------------HERE IS THE PROBLEM. Just not returning anything
         } else {
          return false//<<----------------------------------------------AND HERE. Just not returning anything
         }
        };
        myConnection.load(domainToCheckForConnection);
      }
      }

      I want to return a true false statement back to the root then this class is called e.g. if(new checkForInternetConnection("http:www.google.co.uk")) blah blah

       

      the problem is that when the connection is made no values are returned.

       

      Yet, if i take the function out of the class and run it on the main timeline, the thing works!!!!

       

      Does anyone have any ideas here.

       

      Thanks in advance.

       

      DazFaz