Google

sexta-feira, abril 18, 2008

Flex-Ajax Bridge, uma alternativa ao ExternalInterface e ao LocalConnection

Isso promete e acho que já está na hora de fazer testes.
Quem tem o Flex 3 já baixou o FABridge (sem saber, hehehehe). Ainda é beta, porém os testes de desenvolvimento deste framework são feitos no IE6 e FF2, nossos requisitos!

De acordo com o site, ele tem gerenciamento de memória automática, a possibilidade de destruir objetos manualmente e manipulador de excessões.

Como estamos com alguns problemas com o ExternalInterface e com o LocalConnection, acho que vale a pena testar isso. Pelo menos onde estamos com problemas...

Veja as limitações desta versão:

The FABridge library is currently in a beta state. It has been tested on Mozilla Firefox 2 (Windows and Linux), Microsoft Internet Explorer 6, Opera 9, and Apple Safari 2.0.4.

Exceptions thrown across the bridge into JavaScript depend on the user having installed Flash Debug Player to display the entire error description. Otherwise, only the error ID is thrown.

For performance reasons, when an anonymous object is sent from ActionScript to JavaScript, the bridge assumes it contains only primitives, arrays, and other anonymous objects, and no strongly typed objects or methods. Instances or methods sent as part of an anonymous object are not bridged correctly.

Veja o que tem no site oficial do Flex sobre a FABridge:

The Flex™ AJAX Bridge (FABridge) is a small, unobtrusive code library that you can insert into an Adobe® Flex™ application, a Flex component, or even an empty SWF file to expose it to scripting in the browser.

To humbly borrow a page from the Ruby on Rails community, FABridge is built with the "don't repeat yourself" principle in mind. Rather than having to define new, simplified APIs to expose a graph of ActionScript objects to JavaScript, with FABridge you can make your ActionScript classes available to JavaScript without any additional coding. After you insert the library, essentially anything you can do with ActionScript, you can do with JavaScript.

Adobe® Flash® Player has the native ability, through the External API (the ExternalInterface class), to call JavaScript from ActionScript, and vice versa. But ExternalInterface has some limitations:

  • The ExternalInterface class requires you, the developer, to write a library of extra code in both ActionScript and JavaScript, to expose the functionality of your Flex application to JavaScript, and vice versa.
  • The ExternalInterface class also limits what you can pass across the gap – primitive types, arrays, and simple objects are legal, but user-defined classes, with associated properties and methods, are off-limits.
  • The ExternalInterface class enables you to define an interface so your JavaScript can call your ActionScript – FABridge essentially lets you write JavaScript instead of ActionScript.

View a sample application that makes use of the Flex AJAX Bridge.
Note: You must install Flash Player 9 to view the sample application.

Fonte: http://labs.adobe.com/wiki/index.php/Flex_Framework:FABridge

Nenhum comentário: