Navigation

Previous

Archives

2007年5月6日 @ 20:30

Flex Example: HTTPService & Cairngorm 2.2[转贴]



Flex Example: HTTPService & Cairngorm 2.2

 

转贴:http://www.jessewarden.com/
ws_icon2.jpgPreface

Cairngorm 2.2 was released on labs today. Upon reading Eric's blog entry, I noticed they fixed a WebService bug. Hoping it was the one that sabotaged my original example, I downloaded and implemented. It did fix it, but Amazon had since changed their XML format, thus ruining it anyway. While perusing Amazon's developer API docs, I noticed they had a REST implementation (variables on a URL string) as well as their web service implementation. I always like using REST implementations over web services because they are just easier to debug and the code makes more sense looking at it in my opinion.

So, I've modified my old WebService example that utilized Cairngorm 2.1. This one uses HTTPService instead, and Cairngorm 2.2. I only changed 1 line of code for the Cairngorm update; score for backwards compatibility.

Introduction

This is a simple Flex 2 example application that fetches books from Amazon.com. It shows how to use the Cairngorm 2.2 MVC micro-architecture with an HTTPService. It utilizes Amazon's developer API, so if you don't have web developer API ID with them, you'll need one to compile this example yourself. If you just want to use it, scroll to the bottom. The code that's changed from the original example is updating this example to use HTTPService instead of WebService . Additionally, my E4X skills have improved (a tad... *ahem*) since I wrote the last example, so I updated that factory code as well to be a little cleaner. Hopefully you'll see how easy it is to parse XML using E4X. Finally, I removed all of the source code for Cairngorm and just use their SWC. You then just link this to your project:



  1. Click the project
  2. Go to Project > Properties
  3. Select Flex Build Path on the left
  4. Click the Library Path tab on the right
  5. Click the Add SWC button
  6. Click Browse, and navigate to where your example is on your computer
  7. Choose the Cairngorm.swc, click Open, and then click OK, and finally OK

 

For flow of the application and more context, read the original entry.

Flex 2 HTTPService & Cairngorm 2.2 Amazon Example - App | View Source | ZIP

Share

Filed under: 资料 · Tags: flex  cairngorm  

Articles related:

Calling Event Handlers without Events[转贴]  (2007-5-6 20:25:19)

Flex2.01:基于模块的flex应用开发  (2007-5-5 11:26:37)

AS3的png图片编码器  (2007-5-5 11:24:10)

The Flex Style Explorer is a Proud Papa  (2007-4-12 11:3:42)

Flex Effects Explorer  (2007-3-12 17:26:37)

Leave a Comment

◎welcome to give out your point。

Misc

Linkage