You are currently browsing the Eric Feminella blog archives for May, 2006


FlashAJAXBridge API

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

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

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

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/

Transition to Flex for Flash Developers

For the past 6+ months I have been working full-time at Enterra Solutions, LLC as a Senior Software Developer. My primary role in the organization is designing the architecture of Rich Internet Applications utilizing Flex 1.5 and ActionScript 2.0. After many months of now stop Flex Development I must say that Flex is an awesome platform. I feel completely comfortable in the Flex IDE and I even prefer building applications in Flex these days. I prefer building websites in Flash but as far as serious application development I would choose Flex over Flash hands down.

My true passion is Object Oriented Programming in ActionScript and I see Flex as one more tool for outputting Flash content. Enterra Solutions is partners with Adobe so I have a foot in the door as far as new releases and developments pertaining to Flex, Flash and ActionScript. I spend most of my spare time building prototype applications in FLEX 2.0 / ActionScript 3.0 and I love it. I know that there are many Flash Developers who are not familiar with the Flex IDE and there is a very good transitional breeze seminar presented by Phil Heinz that was posted on the macromedia users group last month. This is a good start for developers looking to add Flex to there arsenal of Flash Platform tools.

Check out the following for an excellent intro to Flex for Flash developers: http://mmusergroup.breezecentral.com/p95561356/

If you have any Flex / Flash related questions feel free to contact me at eric@ericfeminella.com

Flex 2.0 Beta 3 Release

On May 8th, Adobe released Flex 2.0 Beta 3 as well as the first beta release of Flash Player 9. If you haven’t been using Flex 2.0 / ActionScript 3.0 in your spare time I would definetly suggest that you download the latest beta and start playing with some of the new capabilities available in ActionScript 3.0, I am certain that you will be impressed.

Click here to learn more or download the latest beta at http://labs.adobe.com/

ActionScript 2.0 LoadManager:: Preloader API

I packaged a quick and easy LoadManager API which I developed awhile back for handling preloading images and swf’s. The preloader works simply by passing in 3 arguments to a static method; the parent movieclip that you want to create the load container movieclip on, a preloading movieclip, and a string which is the swf or image url that you want to load. The LoadManager then returns a movieclip that the asset is loaded in.

Click here to download the source

PHP Email class

I found an email class that I wrote awhile back in php for sending emails from Flash. To use it simply instantiate an instance of the Email class and pass in the recipient, subject, name, email address and message (see usage example below).

Click here to download the source files