小玩 FABridge 心得速記

In flex   May 12, 2008 - 3:06 pm

最近客戶的要求越來越刁鑽,先是出現 jQuery + flex 的案例,最近又來個 FABridge 的要求,這是代表客戶進步了還是大家開始走回頭路啊…

FABridge 的全名是 Flex-Ajax Bridge,簡單來說就是讓 flex 與 javascript 間的溝通更順暢,雖然以往這種事都是直接透過 ExternalInterface 就可做到,但有了 FABridge 後兩邊的 class 是互通的,type conversion (de/serialization)也是自動完成,因此方便許多。

使用方法很簡單

*Flex 部份

透過 IDE 右鍵勾選 Create Ajax Bridge… 就可自動建立需要的東西,包含
-as3 source path
-自動產生的 js mapping file
-<fab> tag

*html 部份

在 embed swf 的那頁要加入下面兩個 js.

<script src=”../src/bridge/FABridge.js” ></script>
<script src=”FABridgeSample.js” ></script>

其中 src/bridge/* 是共用的 FABridge library,另外那個 .js 就是 IDE 自動產生的 mapping file,兩者缺一不可。

兩邊都設定好後,就可以開始互相 call call 樂了 XD

然後接下來要想辦法搞定那個 jQuery:Jcarousel…

by admin

1 Comment Add your own

  • 1. saicn&hellip  |  May 12th, 2008 at 3:53 pm

    很好,这样给人很多很多追求。

    本来很多猥琐的写法,想法都是这种情况下出来的

留言回應

hidden

您的留言會先經過站長認証後才刊登在網站上。
your comments will be approved by Administrator before appearing on the page.

Trackback this post  |  Subscribe to the comments via RSS Feed

mobile phone