Loading local JSON issue with Sencha, PhoneGap and Android 4.0.3

This is just a little tip when trying to load local .json files using the Ext.data.Store ajax proxy type. The following code will work in Android 4.0.3+ but you need to be sure to add an extra couple lines to get it to work, noCache: false and enablePagingParams: false. Without those lines the code still works fine in Android 2.3.3 but for Android 4 and above, the ajax fails on loading local .json files because the requests url includes parameters added by Sencha.

Roads DataStore

Ext.define("Roads", {
        fields: [
            { name: 'id', type: 'int' },
            { name: 'title', type: 'string' },
            { name: 'subtitle', type: 'string' }
                           noCache: false,
            enablePagingParams: false,
            load:function (s, r) {


        "title":"Interstate 10 Arizona",
        "subtitle":"Papago Freeway/Maricopa Freeway"
        "title":"Interstate 17 Arizona",
        "subtitle":"Black Canyon Freeway"
        "title":"Arizona State Route 101",
        "subtitle":"Loop 101"

References where the solution was found:




FITC Hollywood 2007

I was asked to speak at this years FITC conference located at Universal Studios, Hollywood.   I will be co-presenting with my co-worker Larry Drolet.  Our presentation is called “Concepts on AIR”.  We will demonstrated some basic AIR concepts such as system chrome, drag and drop, and system notification.   We will also present some pretty cool sample applications.   One is called Oxygen, a file management application that manages the Xdrive storage service platform for individual accounts.   

Oxygen is build with Flex and AIR technology and uses the open Xdrive API.  Xdrive will soon release version 1.2 of the JSON API. Oxygen is running this latest JSON release. Oxygen is a great concept piece as it shows how easy it is to take your web-based Flex applications and port them to the desktop.  Oxygen shares about 90% of the same code as Bluestring (Bluestring.com).

Another cool application is called Wormhole.  Its basically a mashup with AIM and Xdrive API’s.  This application really takes advantage of the system chrome features in Flex and offers a very geeked out way to share files (think Stargate).   If you are in the Los Angeles area and have some time, stop by the FITC conference and check out all of the presentations. My presentation description can be found here along with my speaker profile.   The presentation slides are listed below using Adobe Share:


– Mister

Firefox, Flex URLRequest, and Sessions Issue

I ran into a very difficult issue trying to get upload files using FileReference and URLRequest.  File upload was working fine in Internet Explorer, but nothing would work in Firefox.    I tried tracing out the request using LiveHTTPHeaders for Firefox, but I couldn’t even see any of the request data.    With some help from my co-worker we determined that Firefox was not sending the session with the file upload and was producing a login error.  On IE the session cookie is picked up and the upload request uses the authenticated session, no login error.   

Firefox apparently uses another instance of the browser window to dispatch the uploaded file, this window does not have the session.  I searched for some possible answer and it seems you need to ask the correction combination of questions to find the solution.   The Flex documentation seems to hint at part of the issue, but nothing direct enough.

Flex Livedocs:

The FileReference and FileReferenceList classes also do not provide methods for authentication. With servers that require authentication, you can download files with the Flash® Player browser plug-in, but uploading (on all players) and downloading (on the stand-alone or external player) fails. Listen for FileReference events to determine whether operations complete successfully and to handle errors.

So we know that authentication is not being passed along, so what can we do about it.   Searching for information related to URLRequest and sessionid revealed a good Flexcoders post on the same issue.   You need to add the session to the URLRequest (in our case we added the jsessionid for TomCat):

Continue reading →

JSON (Lite)

For a current Flex project we use JSON to transfer data between the application and the backend. Adobe Labs has a JSON serialization library called corelib that includes MD5 hashing, JSON, and other parsing tools.  What if you need just JSON for your Flex or Flash AS3 application development?

There is already a JSON ActionScript file for AS2 available at JSON.org. This file would be great for your older Flash projects and maybe some mobile application development.   Initially, I tried to convert this file to AS3, but then I figured someone probably already did this.   After some extensive searching and help from Lar (as always), we were able to locate a version of JSON that had been converted to AS3 for a project called VEGAS.      

There was no stand alone version of JSON for AS3, we had to extract the JSON pieces from the project files.  I did a little touch up for the error messaging, but it is essentially the same JSON for AS2, just updated to work with AS3.  In fact, it is by the same author, ekameleon.    

I am including all the links to the original source information as well as a stand alone version of the JSON AS3 ActionScript file and Flex Library file with the compiled SWC (called JSONLite).   The total size of the JSON AS3 file is 5KB!   

JSON AS3 (Flash/Flex)


To use the file just add the SWC to your Flex Library path.    In the MXML file, import the file and call to serialize/deserialize the same way you do with the corelib JSON SWC:

import com.serialization.json.JSON;

var dataString:String = JSON.serialize(object);

var obj:Object = JSON.deserialize(string);

I don’t support these files, I am just passing the information along and doing some experimentation with other JSON libraries. Also note that using the JSONLite SWC or class file file instead of the corelib file won’t significantly lighten your Flex applications. Flex only compiles the packages and class files you reference in your application from the library. So the post title is a bit misleading because you only shave off that 1KB. However, I have heard from others that this class file is faster than most other JSON parsers which does give it a slight advantage if speed is a concern.