Archive for May, 2006

FlashAJAXBridge API

Friday, May 26th, 2006

I programmed an API which allows interoperability between AJAX, Flash 8 and Flex 1.5. The FlashAJAXBridge API consists of a few simple ActionScript 2.0 methods which allow you to call javascript methods that target document elements and reset their dataProviders. The API also can invoke calls to an instance of the XMLHTTPRequest object which makes discreet calls to the server for loading external xml documents.

I made a simple example that demonstrates the methods that are available for registering javascript functions which can be invoked in Flash or Flex. A cool little extra that I added is the FlashObject instance is set using attributes from an xml-config document to embed the swf. The config document also specifies which div element to write the FlashObject to.

You can view an example of the API by clicking on the link below:
FlashAJAXBridge.html

AJAX Debugger beta 2.0

Monday, May 22nd, 2006

This weekend I built an AJAX debugger which for handling complex types such as objects, arrays, JSON objects etc. The AJAXDebugger traces out all members of a user defined objects, properties of an object, indexes of an array, keys of an array or other object types to a div tag with an id of “console” in your application.
To use it, just include the debugger.js file and create a div somewhere on the page to use as an output panel. Give the div tag an id of “console” as follows:

To use the debugger simply use the following syntax to trace an object to the console div:

Example:
trace (object, true) - whereas the first param is an object of any type to trace and the second param instructs the debugger to recursively trace out the object or not.

Usage Example:
var obj = new Object();
this.obj.name = “AJAX Debugger”;
this.obj.build = 1.0;
this.trace(obj, true);

Outputs the following to the “console” div:
Found instance of type : Object
.name = AJAX Debugger
.build = 1

An upgrade to verison 2.0 will be made within the next few weeks which will allow the console to be in a seperate window abstracted from the application itself.

To view an example of how the debugger works click on the link below:
AJAXDebugger-v1.0/debugger.html

To download version 1.0 of the AJAX Debugger click on the link below:
http://www.ericfeminella.com/utilities/AJAXDebugger.zip

Feel free to email me with your thoughts on the Debugger.

ObjectHandler API For Flex

Friday, May 19th, 2006

Below is a really useful class that I wrote for handling multiple levels of nested objects. For instance, let’s say in Flex 1.5 you have a tree and it’s dataProvider has to be reset dynamically whenever a node is selected so that each node can receive a small soap message that can be converted to native ActionScript Objects rather than having one big soap message sent over the wire for the entire tree - run-on sentence if ever there was one.

This approach is much more efficient. The only way to do this is to have an object container with any level of nested objects as properties of the container and so on. The class below will locate any object in the container regardless of where it resides in the object hierarchy and append additional objects to the specified object, return that object or delete that object.

Click here to download the ObjectParser

Adobe Spry - Prerelease 1

Thursday, May 18th, 2006

I have been building basic applications in AJAX for awhile now. I definetely enjoy AJAX just as I enjoy any cool new technology. Adobe has released the Spry Framework for AJAX which is a step in the right direction. A friend of mine at work also developed an AJAX MVC which will be available on sourceforge soon. The AJAX MVC is based on a framework which is configured simular to struts MVC in Java. I’ll have a link as soon as it is available.

My biggest complaint about AJAX is that there is no proper implementation for class based development beyond the use of prototype classes, which is a very far cry from standard object oriented languages that implement the ECMA standard such as Java, C# and ActionScript 2.0 and 3.0. Below is a brief breakdown of the Spry Framework for anyone who is interested. If you are constrained to html based applications whereas the use of Flash Player or proprietary frameworks are not an option, then AJAX is definetely your best choice.

The Spry framework for Ajax is a JavaScript library for web designers that provides functionality that allows designers to build pages that provide a richer experience for their users. It is designed to bring Ajax to the web design community who can benefit from Ajax, but are not well served by other frameworks. The first release of the Spry framework is a preview of the data capabilities that enable designers to incorporate XML data into their HTML documents using HTML, CSS, and a minimal amount of JavaScript, without the need for refreshing the entire page. The Spry framework is HTML-centric, and easy to implement for users with basic knowledge of HTML, CSS and JavaScript. The framework was designed such that the markup is simple and the JavaScript is minimal. The Spry framework can be used by anyone who is authoring for the web in their tool of choice.

http://labs.adobe.com/technologies/spry/