By admin

** In case you didn’t notice Pownce has closed down. I’m leaving the API information up for reference.

as3powncelib is a full ActionScript implementation of the Version 2.0 spec of the Pownce API. Full source code is available through googlecode.

Updates

v.8
Added file and media parsing of note data.
Added verifyAuth.
v.7
Removed flex library dependency. The library can now be used in either Flex or Flash. Flash retrieve note example added.
v.61
Initial release of the API.

// Imports omitted for brevity
private const APP_KEY:String = "<your app key>";
 
private var _pownceService:PownceService;
private var _testUsername:String = "<Pownce username>";
private var _testPassword:String = "<Pownce password>";
 
private function initApp():void{
	_pownceService = new PownceService(APP_KEY);
	_pownceService.setAuth(_testUsername, _testPassword);				
}
 
// Example of posting a file
public function testPostAFile():void{
	var file:FileReference = new FileReference();
 
	_pownceService.addEventListener(PownceResultEvent.ON_POST_A_FILE, function(event:PownceResultEvent):void{
			var pownceResult:PownceNotesResult = event.data as PownceNotesResult;
 
			if(pownceResult.success){
				trace((pownceResult.notes[0] as PownceNote).body);
			}else{
				trace(pownceResult.statusCode);
				trace(pownceResult.message);
				trace(pownceResult.request);
			}
		});
 
	file.addEventListener(Event.SELECT, function(event:Event):void{
			_pownceService.postAFile("all", event.currentTarget as FileReference, "File upload test");
		});
	file.addEventListener(ProgressEvent.PROGRESS, function(event:ProgressEvent):void{
			trace(event.bytesLoaded + "/" + event.bytesTotal);
		});
 
	file.browse();
}
private function testGetNoteList():void{
 
	_pownceService.addEventListener(PownceResultEvent.ON_GET_NOTE_LIST, function(event:PownceResultEvent):void{
			var pownceNoteResult:PownceNotesResult = event.data as PownceNotesResult;
 
			if(pownceNoteResult.success){
				trace(pownceNoteResult.notes.length);
			}else{
				trace(pownceNoteResult.statusCode);
				trace(pownceNoteResult.message);
				trace(pownceNoteResult.request);
			}
		});
 
	_pownceService.getNoteList(_testUsername,null, 100, -1, -1);
}

Existing issue:
One method is not currently working. It is the retrieval of the send to list. I’ve posted information about the issue to the google pownce group and hopefully it will be resolved soon.


Vote

flickr