flash on 2013-1-21
...
@author padam
♥0 |
Line 26 |
Modified 2013-01-21 09:33:30 |
MIT License
archived:2017-03-20 09:05:19
ActionScript3 source code
/**
* Copyright marcsali ( http://wonderfl.net/user/marcsali )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/kwRn
*/
//essai
package {
import com.bit101.components.HBox;
import com.bit101.components.InputText;
import com.bit101.components.PushButton;
import com.bit101.components.Style;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
public class Main() {
private var _language:String;
public function Main(language:String = "en") {
_language = language;
}
/**
* Use this to get the URL of the mp3 containing the spoken words of the 'phrase' parameter
* @param phrase
* @return String URL to Google Text to Speech engine
*/
public function say(phrase:String):String {
if (phrase.length > 100) throw new Error("Google currently only supports phrases less than 100 characters in length.");
var qs:String = "tl=" + _language + "&q=";
qs += encodeURI(phrase);
return "http://translate.google.com/translate_tts?" + qs;
}
}
}