1 Reply Latest reply on Jun 10, 2009 8:11 AM by lacherm

    sendAndLoad fails in mac .app version - possible security setting problem?

    lacherm

      Hi all,

       

      I'm having trouble with sendAndLoad working on the .app version of a flash application I made. So far it's only happening on one computer, so it appears to be some sort of security setting.  Here's what's going on:

       

      I've built a flash application (Flash 9, AS2) that has three versions: an online version, a standalone  .exe version for PC, and a standalone .app version for mac. The user must log in to use the application. Online, this is handled by the portal hosting the flash. In the standalone versions, the user must login through the flash application. Through sendAndLoad, it accesses the same database of user info as the online version. The user just enters username/password, clicks "Submit," and if it finds the combination in the database, it lets the user in. If not, it gives them a message saying they entered the wrong username/password.

       

      This has tested fine across macs and pcs, but sadly one macbook can't use the .app version. It launches, they put in valid username/password, hit submit and it freezes. All I can tell is that it gets the httpStatus number 0. As you can see below, I've got it set up to spit out an error message if it fails to load (login_lv.onLoad = function(success)), but it doesn't even do that.

       

      I've put a crossdomain.xml file at the root level of the domain that's set to allow access from any domain.

       

      This computer can log in successfully to the online version of the course, but the .app version seems to be hampered by some sort of security setting. The problem computer's settings match the settings of a mac I've tested successfully. It has up-to-date Flash 10 and is running Leopard. Here are security settings:

       

      System Preferences>Security

           General

                Everything is unchecked

           FileVault

                Turned off

           Firewall

                "Allow all incoming connections" is selected

       

       

      I'd appreciate any ideas anyone has. I'm far from wise about the ins-and-outs of mac security, so I may be missing something. I'm happy to clarify anything.

       

      Code is below. It loads login_lv first, then bookmark_lv. It never gets far enough to load bookmark_lv. The severAppUrl is set to a placeholder for confidentiality's sake. The path is defintely right. It works on other computers.

       

      Thanks!

       

      Mike

       

       

      // create a LoadVars instance

      var login_lv:LoadVars = new LoadVars();

       

      // add the login variables to pass to the server

      login_lv.userid = "";

      login_lv.pwd = "";

      login_lv.modname = "a";

       

      // setup login urls

      var serverAppUrl = "http://myurlhere"; //this is just a placeholder. good ol' confidentiality agreements...

      var loginUrl = serverAppUrl+"login.asp";

       

      // setup bookmark urls

      var bookmarkUrl = serverAppUrl+"menu.asp";

      var bookmark_lv:LoadVars = new LoadVars();

       

      // add the bookmark variables to pass to the server

      bookmark_lv.studentid = "";

      bookmark_lv.isAdmin = "";

      bookmark_lv.modname = "A";

      _global.modnameTemp = bookmark_lv.modname;

       

      // setup login function

      function doLogin() {

      login_lv.userid = login_mc.user_txt.value;

      login_lv.pwd = login_mc.pwd_txt.value;

      login_lv.sendAndLoad(loginUrl,login_lv,"GET");

      }

       

      // send the login info

      login_mc.continueBtn_mc.onRelease = function() {

      this.enabled = false;

      doLogin();

      };

       

      // variables will appear in the login_lv object

      login_lv.onLoad = function(success) {

      if (success) {

      if (this.studentid == undefined) {

      login_mc._x = 0;

      trace("not logged in");

      debug_mc.body_txt.text+="\nnot logged in";

      if(this.reas == "Please Complete Overview and first 3 Module(s) with at least 70 score."){

      login_mc.loginBad_mc.gotoAndStop("r2");

      login_mc.loginBad_mc._visible = true;

      } else if(this.reas == "Please Complete Overview Module first."){

      login_mc.loginBad_mc.gotoAndStop("r3");

      login_mc.loginBad_mc._visible = true;

      } else {

      login_mc.loginBad_mc._visible = true;

      }

      } else {

      login_mc._x = 800;

      trace("now logged in");

      debug_mc.body_txt.text+="\nnow logged in";

      trace("studentid: "+this.studentid);

      trace("isAdmin: "+this.isAdmin);

       

      //track variables for later use

      _global.studentidTemp = this.studentid;

      _global.isAdminTemp = this.isAdmin;

       

      bookmark_lv.studentid = ""+this.studentid+"";

      bookmark_lv.isAdmin = ""+this.isAdmin+"";

      bookmark_lv.sendAndLoad(bookmarkUrl,bookmark_lv,"GET");

      }

      }else{

      debug_mc.body_txt+="\nlogin load error"

      }

      };

       

       

      login_lv.onHTTPStatus = function(httpStatus:Number) {

          this.httpStatus = httpStatus;

          if(httpStatus < 100) {

              this.httpStatusType = "flashError";

          }

          else if(httpStatus < 200) {

              this.httpStatusType = "informational";

          }

          else if(httpStatus < 300) {

              this.httpStatusType = "successful";

          }

          else if(httpStatus < 400) {

              this.httpStatusType = "redirection";

          }

          else if(httpStatus < 500) {

              this.httpStatusType = "clientError";

          }

          else if(httpStatus < 600) {

              this.httpStatusType = "serverError";

          }

       

      debug_mc.body_txt.text+="\n login_lv HTTPStatus number="+httpStatus+" HTTPStatus type="+this.httpStatusType;

      }

       

       

      //prepare bookmarkXML to receive returned info from bookmark_lv function

      var bookmarkXML = new XML();

      bookmarkXML.ignoreWhite = true;

      bookmarkXML.onLoad = bookmark_lv;

       

      // variables will appear in the bookmark_lv object

      bookmark_lv.onLoad = function(success) {

      if (success) {

      trace("bookmarked");

      debug_mc.body_txt.text+="\nbookmarked";

      trace("bookmarkXML: "+bookmarkXML);

      var bookmarkNode = mx.xpath.XPathAPI.selectNodeList(this.firstChild, "/bookmark");

      trace("bookmarkNode: "+bookmarkNode);

       

      var bookmarker:String = unescape(eval("bookmark_lv"));

      trace("bookmarker: "+bookmarker);

      bookmarker = bookmarker.split("<xml>").join("");

      bookmarker = bookmarker.split("<bookmark").join("");

      bookmarker = bookmarker.split("/bookmark>").join("");

      bookmarker = bookmarker.split("</xml>").join("");

      var startIndex:Number;

      var endIndex:Number;

      startIndex = bookmarker.indexOf(">");

      trace(startIndex);

      endIndex = bookmarker.indexOf("<");

      trace(endIndex);

      var bookFinally:String;

      bookFinally = bookmarker.substr(startIndex+1, endIndex-2);

      bookFinally = bookFinally.split("<").join("");

      setBookmarkStr = ""+bookFinally+"";

      trace("string: "+setBookmarkStr);

      _global.newBookmark = bookFinally;

      play();

      }else{

      debug_mc.body_txt+="\nbookmark load error"

      }

      };

       

      bookmark_lv.onHTTPStatus = function(httpStatus:Number) {

          this.httpStatus = httpStatus;

          if(httpStatus < 100) {

              this.httpStatusType = "flashError";

          }

          else if(httpStatus < 200) {

              this.httpStatusType = "informational";

          }

          else if(httpStatus < 300) {

              this.httpStatusType = "successful";

          }

          else if(httpStatus < 400) {

              this.httpStatusType = "redirection";

          }

          else if(httpStatus < 500) {

              this.httpStatusType = "clientError";

          }

          else if(httpStatus < 600) {

              this.httpStatusType = "serverError";

          }

       

      debug_mc.body_txt.text+="\n bookmark_lv HTTPStatus number="+httpStatus+" HTTPStatus type="+this.httpStatusType;

      }