forked from: Dictation Machine Beta
forked from Dictation Machine Beta V2 (diff: 536)
ActionScript3 source code
/**
* Copyright andrewexex886 ( http://wonderfl.net/user/andrewexex886 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8oEI
*/
// forked from andrewexex886's Dictation Machine Beta
package {
import flash.net.URLRequest;
import flash.media.Sound;
import flash.text.TextFormat;
import flash.display.Stage;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.display.Sprite;
import flash.ui.Keyboard;
public class FlashTest extends Sprite {
private var butt:Sprite;
private var tf:TextField;
private var tf2:TextField;
private var vocalLibE:Array=[""];
private var vocalLibC:Array=["點擊Enter開始"];
private var vocalLibS:Array=[""];
private var vocalLibLenght:int;
private var nowVocalNum:int=0;
private var fStage:Stage;
private var mySound:Sound = new Sound();
//XML
private var SelectedCourseName:Array;
private var SelectedCourseTotal:int;
private var VocabXML:XML;
private var VocabTotal:int;
public function FlashTest() {
fStage=stage;
//XML Data
SelectedCourseName=["A_life_as_hard_as_stone"];
//SelectedCourseName=["long_term_vision","Anthropology","Ashes","Baby","Blind","Bulletin","Beauty","Binding"];
SelectedCourseTotal=SelectedCourseName.length;
VocabXML=<VocabularyLibrary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>swap</Eng>
<Chi>交換</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/s/sw/swa/swap%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>harsh</Eng>
<Chi>殘酷的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/h/ha/har/harsh%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>reality</Eng>
<Chi>現實</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/r/re/rea/reality%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>yunnan</Eng>
<Chi>雲南</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/!Yunnan.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>childhood</Eng>
<Chi>童年</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/c/ch/chi/childhood%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>beneath</Eng>
<Chi>在…下面</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/b/be/ben/beneath%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>mountain</Eng>
<Chi>高山</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/m/mo/mou/mountain%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>similarity</Eng>
<Chi>相似</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/similarity.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>highland</Eng>
<Chi>高地的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/h/hi/hig/highland%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>province</Eng>
<Chi>省份</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/p/pr/pro/province%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>envoy</Eng>
<Chi>外交使者</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/envoy.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>organized</Eng>
<Chi>有組織的</Chi>
<Sou>http://img.tfd.com/hm/mp3/O0116500.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>charity</Eng>
<Chi>慈善</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/c/ch/cha/charity%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>unicef</Eng>
<Chi>聯合國兒童基金會</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/u/un/uni/unicef%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>corn</Eng>
<Chi>穀物/玉米</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/c/co/cor/corn%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>tobacco</Eng>
<Chi>煙草</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/t/to/tob/tobacco%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>each</Eng>
<Chi>各個</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/e/ea/eac/each%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>household</Eng>
<Chi>家庭</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/h/ho/hou/household%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>earn</Eng>
<Chi>賺得</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/e/ea/ear/earn%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>annual</Eng>
<Chi>每年的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/a/an/ann/annual%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>afloat</Eng>
<Chi>漂浮</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/a/af/afl/afloat%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>aside</Eng>
<Chi>到旁邊</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/a/as/asi/aside%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>tough</Eng>
<Chi>艱苦的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/t/to/tou/tough%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>cherish</Eng>
<Chi>愛護</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/c/ch/che/cherish%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>typical</Eng>
<Chi>典型的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/t/ty/typ/typical%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>farming</Eng>
<Chi>務農</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/f/fa/far/farming%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>kilometre</Eng>
<Chi>公里</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/k/ki/kil/kilometre%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>during</Eng>
<Chi>在…期間</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/d/du/dur/during%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>dimly</Eng>
<Chi>昏暗地</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/d/di/dim/dimly%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>crammed</Eng>
<Chi>擠滿的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/c/cr/cra/crammed%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>bunk</Eng>
<Chi>卧鋪</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/b/bu/bun/bunk%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>principal</Eng>
<Chi>主要的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/p/pr/pri/principal%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>condition</Eng>
<Chi>狀況</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/x/xc/xco/xcondition%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>especially</Eng>
<Chi>尤其</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/e/es/esp/especially%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>mealtime</Eng>
<Chi>進餐時間</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/m/me/mea/mealtime%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>portion</Eng>
<Chi>部份</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/p/po/por/portion%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>generous</Eng>
<Chi>慷慨的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/g/ge/gen/generous%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>nutritious</Eng>
<Chi>有營養的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/n/nu/nut/nutritious%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>fortnight</Eng>
<Chi>兩星期</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/f/fo/for/fortnight%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>homesick</Eng>
<Chi>思鄉的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/h/ho/hom/homesick%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>blanket</Eng>
<Chi>毛毯</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/b/bl/bla/blanket%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>tragically</Eng>
<Chi>悲劇地</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/tragically.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>accident</Eng>
<Chi>意外</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/a/ac/acc/accident%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>ensure</Eng>
<Chi>保證</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/e/en/ens/ensure%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>remain</Eng>
<Chi>保持不變</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/r/re/rem/remain%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>yearn</Eng>
<Chi>渴望</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/y/ye/yea/yearn%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>beyond</Eng>
<Chi>往更遠處</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/b/be/bey/beyond%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>valley</Eng>
<Chi>山谷</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/v/va/val/valley%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>toil</Eng>
<Chi>長時間辛勞</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/t/to/toi/toil%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>rural</Eng>
<Chi>鄉村的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/r/ru/rur/rural%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>diocesan</Eng>
<Chi>主教管區的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/diocesan.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>rely</Eng>
<Chi>依靠</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/r/re/rel/rely%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>attend</Eng>
<Chi>出席</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/a/at/att/attend%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>conference</Eng>
<Chi>會議</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/x/xc/xco/xconference%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>abroad</Eng>
<Chi>在國外</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/a/ab/abr/abroad%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>realize</Eng>
<Chi>了解到</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/realize.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>granted</Eng>
<Chi>假定</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/g/gr/gra/granted%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>might</Eng>
<Chi>may過去式</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/m/mi/mig/might%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>distributed</Eng>
<Chi>分佈式的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/distributed.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>unevenly</Eng>
<Chi>不規則地</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/unevenly.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>well-off</Eng>
<Chi>富裕的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/well-off.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>persevere</Eng>
<Chi>持之以恆</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/p/pe/per/persevere%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>poverty</Eng>
<Chi>貧窮</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/p/po/pov/poverty%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>brought</Eng>
<Chi>bring過去式</Chi>
<Sou>http://img.tfd.com/pron/mp3/en/US/sg/sgdhsgsjstd5d3srhn.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>currently</Eng>
<Chi>現時</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/c/cu/cur/currently%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>doctorate</Eng>
<Chi>博士學位</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/doctorate.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>meagre</Eng>
<Chi>貧乏的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/m/me/mea/meagre%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>existence</Eng>
<Chi>存在</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/e/ex/exi/existence%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>devote</Eng>
<Chi>奉獻</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/d/de/dev/devote%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>afford</Eng>
<Chi>負擔得起</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/a/af/aff/afford%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>feed</Eng>
<Chi>飼料</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/f/fe/fee/feed%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>constantly</Eng>
<Chi>不斷地</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/x/xc/xco/xconstantly%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>tuition</Eng>
<Chi>教學</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/t/tu/tui/tuition%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>fee</Eng>
<Chi>費用</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/f/fe/fee/fee%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>bear</Eng>
<Chi>忍受</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/b/be/bea/bear%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>youngster</Eng>
<Chi>少年</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/y/yo/you/youngster%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>suggest</Eng>
<Chi>建議</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/suggest.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>completed</Eng>
<Chi>完整的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/completed.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>primary</Eng>
<Chi>初等教育</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/p/pr/pri/primary%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>amazingly</Eng>
<Chi>令人驚奇地</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/amazingly.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>elder</Eng>
<Chi>年紀較大的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/e/el/eld/elder%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>begun</Eng>
<Chi>begin過去分詞</Chi>
<Sou>http://img.tfd.com/pron/mp3/en/US/d3/d3dhdsdostshhr.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>physics</Eng>
<Chi>物理學</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/p/ph/phy/physics%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>university</Eng>
<Chi>大學</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/u/un/uni/university%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>electronic</Eng>
<Chi>電子的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/e/el/ele/electronic%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>science</Eng>
<Chi>科學</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/s/sc/sci/science%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>technology</Eng>
<Chi>科技</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/t/te/tec/technology%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>daughter</Eng>
<Chi>女兒</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/d/da/dau/daughter%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>chemistry</Eng>
<Chi>化學</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/c/ch/che/chemistry%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>beijing</Eng>
<Chi>北京</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/!Beijing.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>college</Eng>
<Chi>學院</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/c/co/col/college%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>generation</Eng>
<Chi>一代人</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/g/ge/gen/generation%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>villager</Eng>
<Chi>村民</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/villager.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>mindset</Eng>
<Chi>心態</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/m/mi/min/mindset%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>deal</Eng>
<Chi>分配</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/d/de/dea/deal%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>important</Eng>
<Chi>重要的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/i/im/imp/important%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>open-minded</Eng>
<Chi>思想開明的</Chi>
<Sou>http://img.tfd.com/pron/mp3/en/US/dg/dgslsjdysjhjshslsdd7dndnh7h3.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>entitle</Eng>
<Chi>給...權力</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/de/0/entitle.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>proper</Eng>
<Chi>適當的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/p/pr/pro/proper%23_gb_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>blossom</Eng>
<Chi>開花</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/b/bl/blo/blossom%23_us_1.mp3</Sou>
</Vocabulary>
<Vocabulary>
<Course>A_life_as_hard_as_stone</Course>
<Eng>charming</Eng>
<Chi>令人着迷的</Chi>
<Sou>http://www.gstatic.com/dictionary/static/sounds/lf/0/c/ch/cha/charming%23_gb_1.mp3</Sou>
</Vocabulary>
</VocabularyLibrary>;
//XML setup
XML_to_Array();
//set Length
vocalLibLenght=vocalLibE.length;
//setup textField
tf = new TextField();
this.addChild(tf);
tf.type=TextFieldType.INPUT;
tf.border=true;
tf.y=50;
tf.width=200;
tf.height=40;
tf2 = new TextField;
tf2.text=vocalLibC[0];
tf2.selectable=false;
tf2.width=200;
tf2.height=40;
this.addChild(tf2);
var txtF:TextFormat= new TextFormat("Arial",30);
//tf.defaultTextFormat=txtF;
tf.defaultTextFormat=txtF;
tf2.defaultTextFormat=txtF;
tf2.setTextFormat(txtF);
//Button
butt=new Sprite();
butt.graphics.beginFill(0,1);;
butt.graphics.drawRect(0,0,50,50);
butt.graphics.endFill();
butt.x=300;
butt.buttonMode=true;
addChild(butt);
butt.addEventListener(MouseEvent.CLICK,postAnsButt);
stage.addEventListener(KeyboardEvent.KEY_DOWN,postAnsKeyboard);
}
private function postAnsButt(E:MouseEvent=null):void{
if(checkAnswer(tf.text)){
//randomGetVocal();
orderGetVocal();
}else{
tf2.appendText("X");
}
tf.text="";
mySound.play();
}
private function postAnsKeyboard(E:KeyboardEvent=null):void{
if(E.keyCode==Keyboard.ENTER){
postAnsButt();
}else if(E.keyCode==Keyboard.F1){
tf.text=vocalLibE[nowVocalNum];
}
}
private function randomGetVocal():void{
nowVocalNum=Math.round(Math.random() * (vocalLibLenght-1));
tf2.text=vocalLibC[nowVocalNum];
}
private function orderGetVocal():void{
if(nowVocalNum>=(vocalLibLenght-1)){
nowVocalNum=0;
}else{
nowVocalNum++;
}
tf2.text=vocalLibC[nowVocalNum];
playmp3(vocalLibS[nowVocalNum]);
}
private function checkAnswer(ans:String):Boolean{
if(ans==vocalLibE[nowVocalNum]){
return true;
}
return false;
}
private function playmp3(mp3url:String=null):void{
mySound = new Sound();
var request:URLRequest = new URLRequest(mp3url);
mySound.addEventListener(Event.ID3, Id3Handler);
mySound.load(request);
mySound.play();
}
private function Id3Handler(event:Event):void {
trace(String("播放mp3:"+mySound.id3.artist));
}
private function XML_to_Array():void{
VocabTotal=VocabXML.Vocabulary.length();
var k:int=0;
for(k=0;k<VocabTotal;k++){
if(check_Selected_Course(VocabXML.Vocabulary.Course[k])){
vocalLibE.push(VocabXML.Vocabulary.Eng[k]);
vocalLibC.push(VocabXML.Vocabulary.Chi[k]);
vocalLibS.push(VocabXML.Vocabulary.Sou[k]);
}
}
}
private function check_Selected_Course(incourse:String):Boolean{
var i:int=0;
while(i<SelectedCourseTotal){
if(incourse==SelectedCourseName[i]){
return true;
}
i++;
}
return false;
}
}
}
