Package | ardisia.components.captcha |
Class | public class CaptchaAudio |
Inheritance | CaptchaAudio flash.events.EventDispatcher |
Like the visual captcha, this is not a secure captcha. A swf inspector could easily see the properties and the token or see the audio assets retrieved. Do NOT use if security is important.
View the technical documentation on the Ardisia Labs website for more information.
DESIGN NOTES
On first glance at the Sound API, it looks easy to extract() each letter's raw sound data as a byteArray and concatenate each data stream and play back the entire captcha as a single Sound object using the loadCompressedDataFromByteArray method. This does not work and is also a problem for other people. This is why I was forced to load and play each character asset individually.
Extract does work to alter the playback of a different sound object in the SAMPLE_DATA event handler, but I couldn't get more than 1 sound file to alter the playback. I could extract all the sound data using extract (byteArray, dataLen 44.1) in the SAMPLE_DATA handler, but I couldn't later get the data to play back.
It is very possible I am missing something since my expertise on sound is very limited.
Property | Defined By | ||
---|---|---|---|
assetURLFunction : Function
User provided function that returns the asset URL for the passed
character. | CaptchaAudio |
Method | Defined By | ||
---|---|---|---|
abort():void
Ends any current playback, removes all listeners, ends any loading,
removes the busy cursor. | CaptchaAudio | ||
charsToSpeech(text:String):void
Convert the characters in the passed string to speech. | CaptchaAudio |
Method | Defined By | ||
---|---|---|---|
errorHandler(event:Event):void
Handles error events from the loader. | CaptchaAudio | ||
getAssetSourceURL(char:String):String
Returns the URL to find the mp3 file for the passed character. | CaptchaAudio | ||
loadHandler(event:Event):void
Handles loading events
| CaptchaAudio | ||
playSounds():void
Play the queued sounds. | CaptchaAudio | ||
removeCursor():void
Remove the busy cursor. | CaptchaAudio | ||
soundHandler(event:Event):void
Handles channel events. | CaptchaAudio |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when the audio assets are fully loaded. | CaptchaAudio | |||
Dispatched when loading the audio assets has thrown an error. | CaptchaAudio | |||
Dispatched when all the audio assets have begun loading. | CaptchaAudio | |||
Dispatched when the speech ends. | CaptchaAudio | |||
Dispatched when the speech begins playing. | CaptchaAudio |
assetURLFunction | property |
public var assetURLFunction:Function
User provided function that returns the asset URL for the passed character. mportantto customize this for each application.
The function has the following expected signature:
funcName(char:String):String
The default value is undefined
.
abort | () | method |
public function abort():void
Ends any current playback, removes all listeners, ends any loading, removes the busy cursor.
charsToSpeech | () | method |
public function charsToSpeech(text:String):void
Convert the characters in the passed string to speech.
Parameters
text:String — the String to convert each char to speech
|
errorHandler | () | method |
protected function errorHandler(event:Event):void
Handles error events from the loader.
Parameters
event:Event — the Event that triggered the handler
|
getAssetSourceURL | () | method |
protected function getAssetSourceURL(char:String):String
Returns the URL to find the mp3 file for the passed character.
Parameters
char:String — the character to return the URL for the mp3 file
|
String — the URL as a String
|
loadHandler | () | method |
protected function loadHandler(event:Event):void
Handles loading events
Parameters
event:Event — the Event that triggered the handler
|
playSounds | () | method |
protected function playSounds():void
Play the queued sounds.
removeCursor | () | method |
protected function removeCursor():void
Remove the busy cursor.
soundHandler | () | method |
protected function soundHandler(event:Event):void
Handles channel events.
Parameters
event:Event — the Event that triggered the handler
|
loadEnd | Event |
ardisia.components.captcha.events.CaptchaAudioEvent
ardisia.components.captcha.events.CaptchaAudioEvent
Dispatched when the audio assets are fully loaded.
loadError | Event |
ardisia.components.captcha.events.CaptchaAudioEvent
ardisia.components.captcha.events.CaptchaAudioEvent
Dispatched when loading the audio assets has thrown an error.
loadStart | Event |
ardisia.components.captcha.events.CaptchaAudioEvent
ardisia.components.captcha.events.CaptchaAudioEvent
Dispatched when all the audio assets have begun loading.
speechEnd | Event |
ardisia.components.captcha.events.CaptchaAudioEvent
ardisia.components.captcha.events.CaptchaAudioEvent
Dispatched when the speech ends.
speechStart | Event |
ardisia.components.captcha.events.CaptchaAudioEvent
ardisia.components.captcha.events.CaptchaAudioEvent
Dispatched when the speech begins playing.