 package ras3r.reaction_view.helpers
 {
+	import fl.controls.*;
+	import flash.utils.*;
+	import mx.events.PropertyChangeEvent;
 	import ras3r.*;
-	import fl.controls.*;
+
+	use namespace flash_proxy;
 
 	public class CheckBoxHelper extends UIComponentHelper
 	{

		public function CheckBoxHelper ()
		{
			super(display_object);
		}

		/**

		**/
		override public function bind_to (object:*, property:String) :void
		{
			// helper responds to changes to object[property]
			object.addEventListener(property + '_change', after_property_change);

			// object[property] responds to changes to text_input.text
			display_object.addEventListener('change', function (e:Object) :void
			{
				// convert true/false to 1/0
				var val:int = (e.target.selected ? 1 : 0);
				// prevent superfluous event firing
				if (object[property] == val) return;
				// update data object
				object[property] = val;
			});

			// setup validation handlers
			// super.bind_to(object, property);
		}


		// >>> EVENT HANDLERS
		/**
		*	update display_object.selected
		**/
		private function after_property_change (e:PropertyChangeEvent) :void
		{
			// convert 1/0 to true/false
			var selected:Boolean = Boolean(e.newValue);
			// prevent superfluous event firing
			if (selected == this['selected']) return;
			// update display object
			this['selected'] = selected;
		}
	}
}
