ZBar-ANE is a native extension to recognize QR codes, bar codes and image recognizer. It works for iOS and Android, sharing the same API in both operating systems. The extension has a simple API and is based on events, which are fired when the recognition happens. In order to read any code, the developer must invoke a method passing a bitmap data as its parameter.

Based on the received bitmap data, the extension will analyze its content and dispatch an event. If the image was correctly analyzed and recognized, a successful event containing the code data will be fired. In case the image was not recognized, a fail event is dispatched.

Sample

public function ZBarTest() {
	var imageWithCode :BitmapData;
	var zbar:ZBar = new ZBar();
	zbar.addEventListener(ZBarEvent.FAIL, _zbarEvt);
	zbar.addEventListener(ZBarEvent.SUCCESS, _zbarEvt);

	zbar.init(imageWithCode );
}

private function _zbarEvt(zbEvt:ZBarEvent):void {
	if (zbEvt.type == ZBarEvent.SUCCESS)
		trace(zbEvt.url);
	else
		trace("fail");
}
Air Native Extension, Android, iOS. URL.