Text To Speech in Adobe Flash AS3

Discussion in 'Google API' started by farzher, Aug 24, 2010.

  1. #1
    I'm using this line of code:

    new Sound(new URLRequest("http://translate.google.com/translate_tts?q=" + inputTxt_mc.text)).play();
    Code (markup):
    everything works great testing it from the .fla but when i host the .swf anywhere online it doesn't work. is google blocking me? Anyone know whats up?
     
    farzher, Aug 24, 2010 IP
  2. higreg7

    higreg7 Peon

    Messages:
    469
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think you need to look into crossdomain.xml .
     
    higreg7, Aug 25, 2010 IP
  3. farzher

    farzher Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    nah, it's googles site blocking me I can't edit their crossdomain. I need to proxy their page from one of my own php pages, anyone know how?
     
    farzher, Aug 25, 2010 IP
  4. higreg7

    higreg7 Peon

    Messages:
    469
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
  5. farzher

    farzher Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yeah thats exactly what i'm doing, it works perfect tested in the .fla but when I put the .swf on any site it's blocked. No online examples work either.
     
    farzher, Aug 25, 2010 IP
  6. higreg7

    higreg7 Peon

    Messages:
    469
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    This one works on my server: http://www.flashcomponentstemplates.com/textSpeechTest/textSpeech.html

    var req:URLRequest= new URLRequest( "http://translate.google.com/translate_tts?tl=en&q=" + encodeURI(_inputPt.text));
    
    var snd:Sound = new Sound(req);
    snd.play();
    PHP:
    Obviously with a dynamic textfield called "_inputPt".

    The example I gave you on ActiveDen also has a link to an online example that works.
     
    higreg7, Aug 26, 2010 IP