Pete Shand
  • Home
  • About
  • Contact
  • Showreel
Home » Actionscript » TextToSpeech Accessibility
May13 6

TextToSpeech Accessibility

Posted by Pete Shand in Actionscript, Text To Speech

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!

6 Comments

  1. Blan | March 10, 2011 at 5:22 pm

    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. Pete Shand | March 16, 2011 at 11:27 am

    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. GP | May 20, 2011 at 4:47 am

    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. Pete Shand | May 20, 2011 at 3:23 pm

    you’ll need to use a proxy, see: http://peteshand.net/blog/index.php/as3-text-to-speech-plus-proxy/

  5. Andre | December 23, 2011 at 12:22 pm

    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…

  6. Pete Shand | December 23, 2011 at 8:20 pm

    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)

Leave a Comment Cancel reply

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

*

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Categories

  • 3D Flash
  • Actionscript
  • Design
  • Facebook
  • Flash
  • Javascript
  • Online Advertising
  • Photography
  • Recent Work
  • Text To Speech
  • Translation
  • Video

Recent Comments

  • Pete Shand on .MPO to Anaglphic or Stereo Pair JPG
  • Pete Shand on .MPO to Anaglphic or Stereo Pair JPG
  • Kyle on .MPO to Anaglphic or Stereo Pair JPG
  • Paul on Actionscript Text To Speech
  • Pete Shand on Actionscript Text To Speech

What I'm Doing...

  • RT I 2nd that @karlfreeman: Painful presentation at #fotb at the moment. Should've gone to monster projects and rewatch it again from their 2010-09-28
  • @ReDrUmNZ I'd leave it at home... ya going on holiday to get any from that shit in reply to ReDrUmNZ 2010-09-14
  • @ReDrUmNZ I can honestly say i haven't had any problems with CS5, stink 2 b u huh, lol in reply to ReDrUmNZ 2010-08-17
  • More updates...
Get Adobe Flash playerPlugin by wpburn.com wordpress themes

© 2011 Pete Shand | Designed by Elegant Themes | Powered by WordPress