豆瓣读书年终统计工具

Categories: 分享; Tagged with: ; @ December 30th, 2012 23:41

只支持

100本以内的已读书目, 如图:

image

 

右上角输入豆瓣ID后按下回车, 等待.

地址: http://liguoliang.com/wp-content/uploads/2012/12/DoubanAnalytics.swf

在Flex中使用JSON新手入门: 读取豆瓣API

Categories: Flex; Tagged with: ; @ December 13th, 2012 17:59

豆瓣提供了丰富的API, 在Flex中可使用WebService快速调用。

读取指定用户收藏过的图书:

image

 

在Flex中使用JSON

FlashPlayer 11开始原生支持JSON:

Native JSON (JavaScript Object Notation) Support — Allows ActionScript developers to take advantage of high performance native parsing and generation of JSON-formatted data.

http://helpx.adobe.com/x-productkb/multi/release-notes-flash-player-11.html

在Flex SDK 4.6中已有顶级类: JSON。

如果使用旧的SDK, 则可以as3corelib:

An ActionScript 3 Library that contains a number of classes and utilities for working with ActionScript? 3. These include classes for MD5 and SHA 1 hashing, Image encoders, and JSON serialization as well as general String, Number and Date APIs.

不过看起来已经有两年多没有更新了。 swc下载地址:  https://github.com/mikechambers/as3corelib/downloads

SDK4.6与As3CoreLib中JSON Class的method name略有不同。

代码:

			private function onJSONLoad(event:ResultEvent):void
			{
				var rawData:String = String(event.result);
				var rawResult:Object = JSON.parse(rawData);
				var books:Array = (rawResult.collections as Array);
				
				var dp:ArrayCollection = new ArrayCollection(books);
				dataGridBooks.dataProvider = dp;
			}

在GitHub上查看完整代码:https://github.com/DavidGuoliang/DoubanAnalytics/blob/master/src/DouBanJson.mxml



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.