05 February 2009

Flex, AIR and SQLite

Dear all,
Yesterday I was reading about connecting Flex with SQLite so we do not need to have any third party tool/application to connect some database. It seems me really useful to have a SQLdatabase and we could directly call it from Flex. No third party plug-ins required for this. I have managed to develop a small code which will create database, table and allow to perform normal login authentication in Flex, you can download source files from here. All you need to run is only Flex.
I hope it will help you too.

15 comments:

nicholas said...

hi your source code is not opening in flex3. it says its not exported well with flex.

Ankur Arora said...

how you are importing it in Flex?

style-sha said...

Hi ankur. i am assigned with the task of creating a contact manager kind of application where the user needs to enter name, age, email etc, which must be stored in the sqlite database and further must get loaded and shown in a data grid. I am new to flex and dont know anything abt sql database. Could you suggest some links that has got illustrated samples to understand the concepts related to achive the above task ? Any help appreciated.

Ankur Arora said...

Hi, before entering into anything I would suggest you to please have a look at basic SQL queries like insert statement, update and delete statements. For basic level understanding you would visit w3c website "http://www.w3schools.com/sql/default.asp" . Once you are through with that you could check my tutorial to use those queries in Flex project to create a desired application. Please let me know in case you would require any other help on this.

Thanks
Ankur Arora

style-sha said...

In your application, when we give the username and password, it just says logged in successfully. But doesnt navigate to other page. What to do for this ?

style-sha said...

Could you say any links similar to this http://shardulbartwal.wordpress.com/2008/04/14/adobe-air-and-sqlite-connectivity/ or anylinks that explains the code ?

Ankur Arora said...

It is not showing any page after logging because I have just given a brief about how could one get connected with SQL lite and fetch data, however if you would require to jump to next step and show a grid or something you could simply place a DataGrid in the main application with visible property as false thereafter when you logged in successfully just make that property to true.

Want more details on this? please let me know.

Thanks
Ankur Arora

style-sha said...

Oh My GOD ! just to do a login validation these much of coding?.

I have got one link http://flexaired.blogspot.com/2008/05/flex-sqlite-example-air-application.html which suits my need. But I need to change its UI completely. Any idea on where I could refer for that.

By the by is it possible to change the style of datagrid and give animated effect to that as found in the link http://examples.adobe.com/flex3/componentexplorer/explorer.html (Point to RemoveItemActionEffect under Effects > Effects, Viewstates and Transitions)

If not is it possible to replace the datagrid with that of a Tile list and embed the above effect to the application (given in flexaired url above) ? Plz download and see.

Your support is very much appreciated.

style-sha said...

And your http://www.thecompositors.com/flash/ is excellent..

Ankur Arora said...

Hi,
thanks for the appreciating my work. Yea you could change the UI completely, we have CSS in Flex which will allow you to specify styles, skins and effects on any of the component. You could take reference from Flex help to know about that and as well as check http://blog.flexexamples.com/ where you can find many tutorials related tot that.

Thanks
Ankur Arora

style-sha said...

hi thanks for your support being given. Is is possible in flex to make the ui elements appear one after the other. for instance in your http://www.thecompositors.com/flash/ link first the outer links appear and then the inner content appears with effect. Similarly is is possible in flex to make appear the ui elements one after the other with effects ? If so what is the property to be set/ or what is the method ?

regards,
idea-boss

Ankur Arora said...

Yes you could use transitions like "Move" for making animation of links and complete event of transition will allow you to show content once the transition is finished.

You could find a tutorial on "Move" transition here:- http://www.switchonthecode.com/tutorials/flex-snippet-simple-tween-effects

style-sha said...

Hi Ankur, Thanks for the info. No i am facing am issue. I have a data grid placed inside a form which is again inside a panel. And the panel is inside a canvas. The issue is i am not able to move the datagrid inside the the form as i wish and if i have the same width size of the grid to the width of the form, I get horizontal scroll and the datagrid always have a space at its left i.e., between the grid and the form (like margin in css). How to solve this ? Below is the code.

(mx:Panel width="473" height="371" layout="absolute" x="9" y="21" horizontalAlign="left"
verticalAlign="middle" color="#FFFFFF" headerHeight="39" )
(mx:Form x="0" y="0" width="453" height="320" horizontalGap="0")
(mx:DataGrid width="421")

(mx:columns)
(mx:DataGridColumn headerText="header 1" dataField="col1"/)
(mx:DataGridColumn headerText="header 2" dataField="col2"/)
(mx:DataGridColumn headerText="header 3" dataField="col3"/)
(mx:DataGridColumn headerText="header 4" dataField="col4"/)
(mx:DataGridColumn headerText="header 5" dataField="col5"/)
(mx:DataGridColumn headerText="header 6" dataField="col6"/)
(/mx:columns)

(/mx:DataGrid)
(/mx:Form)
(/mx:Panel)

Ankur Arora said...

I did not get what exactly you are looking for, could you please elaborate it more?

style-sha said...

Hi ankur, Plz ignore the above issue as it was solved. Now i am assigned with a list of tasks and i expect the max support from you as I am a beginner in flex pgming. To say my task in a word it is "Showing complex data items in a Data Grid" ie., imaging a datagrid loaded with Name,address, Phone no and email in separate columns. If we click or mouse over on any of the items. for ex. if the mouse is hovered or clicked on email field a small content box must pop up showing all the details for that particular row in which the email is selected. ie. it must show the name, phone no, address along with the selected email field. Is this hard to achieve ? Any methods or links u suggest for this as reference. Any help appreciated in advance.

Post a Comment