XLEFF - an XML Layout Engine For Flash

Article
What is XLEFF?
Part I - Introducing the XML Layout Engine concept
Readers of this article should have a basic understanding of the following: ActionScript 2, Adobe (formerly Macromedia) Flash component-based applications, the SWF file format, and XML.

XLEFF is the acronym of XML Layout Engine For Flash, which is reminiscent of what XLEFF is: an XML layout engine, designed to be included in an SWF file.

The XML Layout Engine concept

An XML Layout Engine is a software functionality that allows you to generate a component-based user interface starting from an XML description.

A concrete example will clarify what XML Layout Engines do: let's consider the case of creating a Flash user interface made of one instance of the Button component only, as shown in the following figure:

One Button Interface

In our example the stage size is 300x200 pixels and the Button instance is placed at (X: 100, Y: 89) as highlighted by the next figure:

One Button Interface, coordinates

Flash developers currently have two options to create a component-based user interface like that:

  • They can create the Button instance in the authoring environment, or
  • They can use ActionScript to generate the Button instance at runtime

Creating the Button instance in the authoring environment is a manual process that requires dragging the component on the stage and then adjusting its position and size, if needed.

The following example shows how the ActionScript code generating the same Button instance may look like:

var myButton:Button =
createClassObject(Button, "myButton", getNextHighestDepth(),
{_x:100, _y:89});

An XML Layout Engine, quite simply, provides a third option by allowing the creation of the same user interface via an XML description similar to the following snippet:

<button name="myButton" x="100" y="89" />

First conclusion

The three options considered in this article are very different from each other. The second part will explain what are the exclusive benefits deriving from the approach supported by XLEFF.

Recommended Book

Published: February 27, 2006

Mastering
the Flash Component Architecture

by Antonio De Donatis
Mastering the Flash Component Architecture

The Flash authoring environment comes with a hidden treasure.

Apart from the powerful components that can enable the development of Rich Internet Applications, it also includes the source code of the whole component architecture that you can use to learn how to customize the existing components and how to reuse its rich functionality, with the help of this essential book from the AdvancED series of friends of ED.

Core Sections

  • XLEFF Sampler
  • XLEFF Source Code
  • XLEFF Genesis


An XML Layout Engine For FlashCopyright © 2005-2006 Antonio De Donatis