Release a Floating Licesne

The final piece of the puzzle is to release a floating license when the user exits the application. If we have a checked out or demo license, there is no need to release it. It will expire automatically after its checkout period is reached.

private function releaseLicense(event:Event):void
	this.status = "Releasing License.........";
	//check to see if we have a license
	var licenseValues:HashMap = new HashMap();
	var result:int = licenseClient.validate("1", "4RjPInHGpv0fFJ1CcdyG", licenseValues);
	if(result == NLMConstants.RESPONSE_OK)
		//check to see if this is a floating license
		if(licenseValues.find("locktype") == NLMConstants.LOCK_FLOATING)
			//cancel this event so that we don't close until
			//the license is released

			//go ahead and release this license
			licenseClient.addEventListener(LicenseClientEvent.LICENSE_RESPONSE, handleReleaseLicense);
			licenseClient.releaseLicense("4RjPInHGpv0fFJ1CcdyG", "1");
			//go ahead and shut down.  We have a checked out
			this.removeEventListener(Event.CLOSING, releaseLicense);