2 Replies Latest reply on Aug 22, 2011 4:12 PM by Kurrykid

    How to Pass Data to a Class (Flex 4.5.1)

    Kurrykid Adobe Community Professional

      I am using a SQLite database to store my data.  What I need help with is how to pass the data from the main application to the class that has the SQL statements/commands in it.  For example, I want to pull the value of a text input and put it in the SQL statement that's in the class to run the query.  What I am not sure about about is how to refer to the text input box on the main application.  If I just put the id of the text input box, it gives an error.

       

      Thank you.

       

      Dave

        • 1. Re: How to Pass Data to a Class (Flex 4.5.1)
          kokorito Level 4

          pass parameters to the methods

           

          for example

           

          in the DatabaseManager class

           

           

          public function getByCity(cityName:String):ArrayCollection
          {
               stmt = new SQLStatement();
               stmt.sqlConnection = sqlConnection;
               stmt.text = "SELECT * FROM contract WHERE city=:pcity";
               stmt.param[":pcity"] = cityName; 
               stmt.execute();
               var r:ArrayCollection = new ArrayCollection(stmt.getResult().data);
               return r;
          }
          

           

           

          then in your main file

           

          list.dataProvider = myDB.getByCity(cityTextInput.text);

           

           

           

          something like that

          • 2. Re: How to Pass Data to a Class (Flex 4.5.1)
            Kurrykid Adobe Community Professional

            Thanks Kokorito...you've bailed me out again   I appreciate it very much!

             

            Dave