Getting CouchDB / Couchbase Server and Flash to Play Nice Together
I was Googling and came across Todd Anderson's (blog) project on GitHub called, "as3couchdb". My only problem is that I prefer to do almost everything exclusively in Flash. I noticed Todd had an AS3 version in his example projects, but that it requires Flex because of the custom metadata at the time of compiling. So you would get an error like this,
"Error: The CouchModel instance [com.custardbelly.couchdb.example.model::ContactDatabase] must be annotated with [DocumentService] metadata tag."
I found a hack-around, so anyone else wanting to use CouchDB and within the Flash IDE can do so (assuming you have CouchDB running locally already - if not, download Couchbase Server here)...
- Simply create a new Flash project
- Download Todd's as3couchdb and getting the example BasicActionScriptExample Class under the Properties Panel -> Publish -> Class in the Flash IDE
- Go to your Publish Settings, and check the SWC box under Publish (make sure you do this, otherwise you will get this metadata tag error: "Error: The CouchModel instance [com.custardbelly.couchdb.example.model::ContactDatabase] must be annotated with [DocumentService] metadata tag."
- The compile your project... the example should publish and work! How about that for getting started quickly?
If you have any questions feel free to leave a comment. I'm using Flash CS5 and Couchbase Server (CouchDB v 1.0.2) on a Mac.
For those interested in how I found this hack-around:
Images used above curteosy of seokchanyun & mondi



