When working with local data in mobile applications you might want to consider a SQLite database. Those are especially useful when working with large amount of data that you want to filter at runtime.
Flex Mobile projects can simply take advantage of SQLite support in the Adobe AIR runtime. You could certainly write it from scratch – meaning you create a File instance and SQLConnection, set up event listeners, wait for the connection to open and set up a SQLStatement with a SQL query and more event listeners.
Just to illustrate how easy these wrapper classes make things for you when writing Flex Mobile projects look at the code below. These two lines do everything you need to open a connection to your database file and select all the records.
You can see that using the open event on the SQLite tag we can wire it up to automatically run the query that selects all the records from our database.
The only thing left to do is pass the result of the database query to a component to display it in our mobile application. In this case I’ll be using a List component and assigning the data property of the query instance when the result event fires
Running the code above will query the database for all records and show it in the List component.
In a more advanced application you would set up more Query tags to correspond to different queries or maybe updating or deleting records from the database. Have fun!