TextToSpeech Accessibility

Get Adobe Flash player

I recently posted a TextToSpeech as3 interface class which you can view here. Basically you pass it a string and it will read it out loud.

Today I’ve added an easy way to increase the accessibility of your flash microsite without having to go through the whole project adding code to every button. Simply add the two lines below to your root document and this class will search through every display object and add rollover text to speech.

?View Code ACTIONSCRIPT
1
2
3
import ps.GText2Speech.Accessibility;
 
var accessibility:Accessibility = new Accessibility(this);

You can also specify to read the text on a click or rollout instead of the default rollover.

?View Code ACTIONSCRIPT
1
2
3
4
5
6
import ps.GText2Speech.Accessibility;
 
var accessibility:Accessibility = new Accessibility(this);
accessibility.Rollover = false;
accessibility.Click = true;
accessibility.Rollout = true;

In most cases there will probably be some textfields you want to ignore, so if you need to do this simply add the display object to the exclude list.

?View Code ACTIONSCRIPT
1
accessibility.exclude(mc_skip);

You can download the source and example files here.

If you fine any bugs or have any additional feature requests please post them below.
Enjoy!

8 Comments

  1. Hi!

    I download the example and change the language to HUNGARIAN. The code is working but the special hungarian characters (like: “á” “é”) is not.

    for example “á” -> silence

    Do you have any idea, what i make wrong?

    Thank you!

    Blan

  2. This issue has to do with the way the data is returned (a json string). Usually when I work with special characters with xml I’ll wrap everything within CDATA tags, however because google returns a json string without CDATA special characters like “á” “é” don’t appear to be coming through as they should. You could put a script between the google url and your swf that parses the return data into xml with CDATA tags. hope this helps.

  3. Hi,

    thank you for the class, it works perfectly in local, but when I put on my server it doesn’t work anymore…
    What should I do for making work it online?

    Thanks,

    Gabriele

  4. Hi there Pete, congrats for the awesome job, I have a question for you, could this class be used with other languages like brazilian portuguese or french…?

    Regards…

  5. Hey Andre. yep, absolutely. You just need to set the Lang property on your TextToSpeech object.
    eg:

    ?View Code ACTIONSCRIPT
    1
    
    textToSpeech.Lang = 'fr';

    or you can import ps.GTranslate.Language and this will give you code hinting for all the supported languages.
    eg:

    ?View Code ACTIONSCRIPT
    1
    2
    3
    
    import ps.GTranslate.Language;
     
    textToSpeech.Lang = Language.FRENCH;

    Also if you haven’t already seen the other posts on google text to speech you can check them out here (although some of these examples might be out of date)

  6. Hi Pete

    This works perfectly on my pc when published in Flash. However as soon as I try to publish in AIR for Android 3.2 I get the following error

    Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.

    I am running Flash CS6 but always had the same problem using CS5.5 previously.

    Thanks

    Paul

  7. Hi Paul

    Yep it’s un-tested with air. the error is annoying that it doesn’t give you more information but Stream Error suggests there might be cross domain issues or something along those lines. All I can suggest is to have a look inside the classes I’ve provided and try to isolate the problem. If it’s a cross domain issue you might be able to use a proxy as a work around.

Submit a Comment

Your email address will not be published. Required fields are marked *