Tag Archives: HTML5

Flash Professional CC – Toolkit for Dart

Toolkit for Dart

With Flash Professional CS6, Adobe released an extension called “Toolkit for CreateJS” which allowed Flash Professional content to be exported for use in the HTML5 canvas element via CreateJS libraries. With Flash Professional CC – the toolkit is actually integrated into the core product.

Why stop at CreateJS?

Along with Flash Professional CC – Adobe is also releasing an additional toolkit as an extension… “Toolkit for Dart“. From the FAQ:

The Toolkit for Dart is an extension to Flash Professional CC to publish artwork and animation to the Dart language, which is a class-based, object-oriented language and compiles to efficient JavaScript that is being developed as open source by Google. The extension creates a fully functional and cleanly organized Dart project, leveraging the StageXL for Dart library to reproduce Flash runtime features.

Learn more at http://toolkitfordart.github.io/.

PhoneGap: Saving Arrays in Local Storage

One of a handful of local storage options for PhoneGap applications is the localStorage solution which is actually part of the W3C specs. It provides access to a W3C Storage interface since we are just dealing with HTML5 in PhoneGap. This is a good option for storing simple strings but what if we want to store more complex data structures but don’t want to be bothered with a SQLite database for our application? It’s actually possible to do this via some JSON trickery!

In this example, we will first initialize our Array object to hold all the data:

var gatheredPosts = new Array();

We can then create complex data structures and push these into our array for immediate use in the application – and to back up via local storage options for later. Here’s some dummy code which demonstrates this:

// let's imagine these "posts" come from a remote data call which has just returned
for (var i = 0; i < posts.length; i++) {
    gatheredPosts.push({title:posts[i].title, url:posts[i].url, content:posts[i].content});
}

At this point, we could attempt to write the array to local storage via the normal method... but this will not work with complex objects like arrays out of the box - and will fail to write the appropriate data:

window.localStorage.setItem("cachedPosts", gatheredPosts);

What we need to do to be able to save and retrieve complex array data is to extend the Storage prototype with new methods which will stringify our array data into JSON and also parse the stringified data into a new data object for retrieval. It's a lot simpler than it sounds. Just include these definitions in your JavaScript:

Storage.prototype.setArray = function(key, obj) {
    return this.setItem(key, JSON.stringify(obj))
}
Storage.prototype.getArray = function(key) {
    return JSON.parse(this.getItem(key))
}

We can now use these new methods to properly store and retrieve our array structures!

Here we see array storage:

window.localStorage.setArray("cachedPosts", gatheredPosts);

And array retrieval:

gatheredPosts = window.localStorage.getArray("cachedPosts");

Not a bad solution :)

Absinthe Dilution Faerie 2.0

Absinthe Dilution Faerie

Absinthe Dilution Faerie version 2.0 is now available for free via Google Play!

“Absinthe Dilution Faerie” is a small application which calculates how much water one should temper a dose of absinthe with in accordance with the ABV percentage as laid out by Michael Meyers of The Wormwood Society.

So what’s new in this version? Quite a bit!

  • New application imagery
  • Default database of absinthes
  • Clicking upon an absinthe will load it into the calculator
  • Ability to add your favorite absinthes to the database
  • Database management: add/update/delete
  • Include tasting notes for each brand of absinthe

So… go download and louche up a few ;)

The application was compiled with PhoneGap Build and written with HTML, CSS, and JavaScript. Libraries used include jQuery Mobile and HTML5SQL.JS. Also – please welcome Midge back as the faerie, herself!

PhoneGap and HTML5SQL.JS

I’ve been doing a lot of digging around in PhoneGap lately. This dovetails nicely with my Edge Animate and Edge Reflow work – but I also see it as an extension of my work with Adobe AIR and Flash Player on mobile.

One of the interesting things about working in web technologies with modern browsers (including mobile), is that we have so many choices due to fragmentation or simply because of competing ideas. I’ve found many of the solutions for web storage on mobile to be either lacking or frustratingly complex. A few weeks back, I rand across a nice solution to simply all of this and have adopted it into my workflow.

HTML5SQL.JS makes working with local databases in a PhoneGap app super easy. This video demonstrates how to use it within a project.

Also – you can check out my progress for this app on the project Github repository.

Absinthe Dilution Faerie

absinthewormwood

“Absinthe Dilution Faerie” is a small application which calculates how much water one should temper a dose of absinthe with in accordance with the ABV percentage as laid out by Michael Meyers of The Wormwood Society.

The application also has the support of The Wormwood Society! If you are at all interested in absinthe or absinthe education; The Wormwood Society is an absolutely invaluable resource.

Happy to say that some prominent Absintheurs are supportive of this little application!
review

Grab it for FREE on the Google Play store:

Get it on Google Play

I’ve also created an entry for the app on the PhoneGap site: http://phonegap.com/app/absinthe-dilution-faerie/