1 Reply Latest reply on Nov 29, 2012 2:06 PM by Gaius Coffey

    Where is the database connection for a mobile site?


      I have a Flash mobile site that I didn't create, but need to edit. On clicking the submit button it checks that the login & password are in a SQL database. The problem is, I can't find the method that runs a query on the database or where the database is even connected. I've tried searching through the code for words like "SQL", "database", and "connection" without success. I stepped through the code where I find a call to method "super", but then it goes back to the original method and then the user is logged in. Can someone explain where the call to the database is?

      Other things I'd like to know are: Where is the SQL Connection? In the main (non-mobile site), there is a web.config with a line that says

      <add name="TPConnectionString1"  connectionString="DataSource=xxx.xx.xxx.xx,xxxx\sqlexpress;Initial Catalog=TP;Persist Security  Info=True;User ID=xxxxx" providerName="System.Data.SqlClient"/>

      Where (what file: ex. web.config, xyz.as, etc.) would a similar line in the mobile code be?

      What does super(type, bubbles, cancelable) do?

      Here's the method for the submit button: LoginView.mxml

              private function btnclicked():void{  techController.username = txtUsername.text;  techController.password = txtPassword.text;  var evt:TechEvent = new TechEvent(TechEvent.LOGIN_USER);  this.dispatchEvent(evt);  }

      Here's the TechEvent function that is called: TechEvent.as

          public function TechEvent(type: String, bubbles:Boolean=true, cancelable:Boolean=false)  {  super(type, bubbles, cancelable);  }

      Here's the dispatchEvent method: UIComponent.as

      override public function dispatchEvent(event:Event):Boolean  {  if (dispatchEventHook != null)  dispatchEventHook(event, this);    return super.dispatchEvent(event);  }
        • 1. Re: Where is the database connection for a mobile site?
          Gaius Coffey Level 2

          You are looking for an event handler for the TechEvent.LOGIN_USER event.


          Coding style looks similar to a SWIZ style framework, in which case, the event handlers could be defined using metadata [EventHandler] or [Mediate] tags, but could just be a plain simple .addEventListener(TectEvent.LOGIN_USER,fn); declaration earlier on.


          Either way, this is what has happened:


          1. User enters uname and password, then clicks button

          2. Button click handler populates the techController with relevant values then dispatches an event to let the world know it has done so

          3. The event handler checks the techController and makes the login call

          4. Some time later, the server will respond and trigger another event that the app can respond to