Harish Sivaramakrishnan

Platform Evangelist @ Adobe

Archive for the ‘HTML5’ tag

Flash + HTML 5 : Offline Flash Apps using DataStore API

8 comments

Have been hearing a lot of discussions and arguments about how HTML5 is going to replace (kill!) flash in the near future. And no, this blog post is not about which technology is going to replace or kill which one! I have been a flash developer for quite a long time now and I love the stuff that I can do with Flash and ActionScript. As a developer who cares about technology, I like to experiment with new technologies and try to see how they interoperate.

This blog is the result of a small experiment that I did with the HTML5 datastore API. I wrote up a very simple ActionScript + JavaScript library that would enable developers to make their flex applications work offline in browsers that support HTML5 datastore APIs. The API will now let you use SQL statements (as of now, CREATE, SELECT, INSERT, DELETE & UPDATE) within your actionscript / flash / flex applications.

Check out a demo here . The demo creates a database “SampleDB”. You can perform basic operations using SQL statements that can be previewed live in this application. I have tested this application on Safari & Chrome. If you find issues, please do send me an email and I would take a look at it!

Tested browsers: Google Chrome 5.0.375.55 and Safari 3.2.3

You can download the source files of this experiment from here. If you want to see the demo in action from your own system, download the demo assets from here. Just unzip the contents and paste it in the webroot of your webserver and run.

Incase, you are wondering what SQL statements to try out, you could use the following to start with.

  • CREATE TABLE IF NOT Exists CUSTOMERS (customername TEXT, customeremail TEXT, customerdesignation TEXT, customerphone TEXT)
  • INSERT INTO CUSTOMERS (customername, customeremail, customerphone, customerdesignation) values (‘a’,'b’,'c’,'d’)
  • SELECT * FROM CUSTOMERS

NOTE: The API supports prepared statements, but the demo doesn’t (blame it on my laziness). If you want to try out using prepared statements, download the source files and try out by making your own flex app.

Written by Harish Sivaramakrishnan

May 28th, 2010 at 6:44 pm

Posted in Flash,flex

Tagged with , ,