package com.exanimo.security.recaptcha { import com.exanimo.controls.ButtonClip; import com.exanimo.security.recaptcha.BaseRecaptchaWidget; import com.exanimo.security.recaptcha.RecaptchaWidgetEvent; import flash.display.*; import flash.events.MouseEvent; import flash.net.navigateToURL; import flash.net.URLRequest; import flash.text.TextField; /** * * .. * * @langversion ActionScript 3 * @playerversion Flash 9.0.0 * * @author Matthew Tretter (matthew@exanimo.com) * @since 2008.03.14 * */ public class SimpleRecaptchaWidget extends BaseRecaptchaWidget { private var __audioModeContentContainer:Sprite; private var __imageModeContentContainer:Sprite; /** * * * */ public function SimpleRecaptchaWidget() { this.__audioModeContentContainer = this.getChildByName('_audioModeContentContainer') as Sprite; if (this.__audioModeContentContainer) { this.__audioModeContentContainer.addEventListener(MouseEvent.CLICK, this._audioModeContentContainerClickHandler); this.__audioModeContentContainer.mouseChildren = false; this.__audioModeContentContainer.buttonMode = true; } this.__imageModeContentContainer = this.getChildByName('_imageModeContentContainer') as Sprite; this.addEventListener(RecaptchaWidgetEvent.MODE_CHANGE, this._modeChangeHandler); var modeButton:ButtonClip = this.modeButton as ButtonClip; modeButton.toggle = true; this._modeChangeHandler(); } /** * * * */ override protected function addRecaptchaImage(image:DisplayObject):void { this.__imageModeContentContainer.addChild(image); } // // private methods // /** * * * */ private function _audioModeContentContainerClickHandler(e:MouseEvent):void { if (this.url) { navigateToURL(new URLRequest(this.url), '_blank'); } } /** * * * */ private function _modeChangeHandler(e:RecaptchaWidgetEvent = null):void { if (this.__imageModeContentContainer) { this.__imageModeContentContainer.visible = this.mode == RecaptchaMode.IMAGE; } if (this.__audioModeContentContainer) { this.__audioModeContentContainer.visible = this.mode == RecaptchaMode.AUDIO; } } } }