Nitobi
About Nitobi
Services
Products
Home -> Blogs -> Dave Johnson

Dave Johnson

Archive for the 'Flex' Category

URLs are Important

February 8th, 2006

Who knew that everyone would think that URLs are so important!

James Governor has a great overview of the very informative presentation by Josh Schachter from del.icio.us.

I would have to also agree that the Adobe Flex presentation was way out of left field - I guess they were essentially paying for the conference to get in a Flex sales presentation :)

Tom Coates from Yahoo! also had a great presentation covering similiar stuff to Josh.

AJAX Offline

October 8th, 2005

Just a quick post about running AJaX offline. With the recent release of Flash 8 it seems a good time to bring this up since Flash 8 has everything you need for a robust cross-browser data persistence layer. The two main features of Flash 8 are the SharedObject (although this has been around for a few years now - since Flash 6) and more importantly full JavaScript support. The SharedObject allows you to store as much data as the end user wants to allow and this limit can be configured by the end user.

In the Flash file you can use the ExternalInterface to expose methods to the JavaScript runtime like this:

import flash.external.ExternalInterface;
ExternalInterface.addCallback("JavaScriptInterfaceName", null, FlashMethod);

Similarly you can call JavaScript functions from within the Flash file using the call method of the ExternalInterface

ExternalInterface.call("JavaScriptMethod");

And you can call methods in the Flash movie from JavaScript like this:

function CallMethod() {
if (document.getElementById)
myFlash = document.getElementById("FlashMovieNodeId");
if (myFlash)
myFlash.flashFunction();
}

The other piece of the puzzle is the SharedObject which is accessible through ActionScript in Flash.

var my_SO:SharedObject = SharedObject.getLocal("MySharedObjectName");
my_SO.data.eba = dat;
var ret_val = my_SO.flush();

It is importatnt to note that if the end user specified data size limit is smaller than the requested amount of data to be saved it needs to show the Flash movie to the user (do this simply with a little JavaScript) so the user can either increase the cache size or not. The

ret_val
from the SharedObject
flush
method can be checked to see the result and determine if the Flash movie needs to be shown for input or not.

The other great thing about this is that the upgrade path to Flash 8 has been made a bit better. You can actually have the Flash 8 player installed through the old Flash player from what I understand (called Express Install I believe).

All and all a pretty slick way to persist data with AJaX without relying on cookies or the User Data behaviour in IE.


Search Posts

You are currently browsing the archives for the Flex category.

Pages

Archives

Categories

All contents are (c) Copyright 2006, Nitobi Software Inc. All rights Reserved
Dave Johnson Entries (RSS) and Comments (RSS).