About the Bridge Framework
Bridge is a framework built in Flash that enables the creation of Rich Internet Applications using XML. Bridge works by scanning through individual nodes for namespaces and sending those nodes to their rightful module. Three examples are provided below to help you further understand the framework.
Here is an example.
Here are the steps taken place when executing the node:
1. The node first scans through the attributes and finds the namespace “xmlns”.
2. The node is passed to the XMLNS module.
3. The XMLNS module registers a Component Module with a namespace “view”.
4. The XMLNS module registers an Instance Module with a namespace “instance”.
If you were to use those modules you could type the following node:
In this example, “view” is found and the node is sent to the Component Module. The Component Module then creates a new instance of Sprite and then adds it to the View. The Instance Module then executes the “instance:id” property, and registers the new instance of Sprite to the Symbol Table with the name “myComponent”. This will allow the new Sprite instance to be used throughout the document. To access the new instance, we can use curly brackets. Here’s an example using the Observer Module:
In this example we are listening for a mouse up event dispatched by our Sprite Instance. Attribute values wrapped in curly brackets are parsed by the Runtime Compiler and the result replaces the text. Without curly brackets, the attribute value is parsed as a regular string, and if the instance is not found in the symbol table, a “null” value will be returned. This also applies to boolean values. For example:
If I were to create a new instance of sprite with a visibility of “false”, I would have to use visible=”{false}”. If I were to omit the curly brackets, visible=”false” would return true, since a string converted to a boolean value literally translates as boolean true.
I can also omit some parts of attribute values from being parsed. For instance:
If I wanted to show where my new sprite was, I could type
<view:Label text=”the position of myComponent is x:{myComponent.x} y:{myComponent.y}” />
and it would output as “the position of myComponent is x:0 y:0”.