选择显示字体大小

在flash中用xml实现多语言支持

 

2、新建一个xml文件,命名为french.xml,本文件用来支持法语,保存的格式为utf-8格式,保存的内容如下:



<?xml version="1.0" encoding="utf-8"?>
<content>
<english_btn>anglais</english_btn>
<french_btn>fran?ais</french_btn>
<spanish_btn>espagnol</spanish_btn>
<german_btn>allemand</german_btn>
<italian_btn>italien</italian_btn>
<portuguese_btn>portugais</portuguese_btn>
<content_txt>voici un exemple de ce que vous pouvez faire avec dossiers xml externes et éclat mx. cliquez sur tout drapeau et automatiquement tous les champs du texte sont mis à jour à quel que soit langue que vous sélectionnez. la pince du film ne traduit pas texte. il lit simplement le texte traduit que vous écrivez dans le document xml. alors il est chargé dans votre film.</content_txt>
</content>

  3、新建一个xml文件,命名为german.xml,本文件用来支持德语,保存的格式为utf-8格式,保存的内容如下:



<?xml version="1.0" encoding="utf-8"?>
<content>
<english_btn>englisch</english_btn>
<french_btn>franz?sisch</french_btn>
<spanish_btn>spanisch</spanish_btn>
<german_btn>deutsch</german_btn>
<italian_btn>italienisch</italian_btn>
<portuguese_btn>portugiesisch</portuguese_btn>
<content_txt>hier ist ein beispiel von dem, was sie mit externen xml-akten und flash mx machen k?nnen. klicken sie auf jeder fahne an, und automatisch werden alle textfelder zu welch sprache aktualisiert der sie auserlesen. die filmklammer übersetzt keinen text. es lautet den übersetzten text, den sie das xml-dokument einfügen, einfach. dann wird es in ihren film beladen.</content_txt>
</content>

  4、新建一个xml文件,命名为italian.xml,本文件用来支持意大利语,保存的格式为utf-8格式,保存的内容如下:



<?xml version="1.0" encoding="utf-8"?>
<content>
<english_btn>inglese</english_btn>
<french_btn>francese</french_btn>
<spanish_btn>spagnolo</spanish_btn>

<german_btn>tedesco</german_btn>
<italian_btn>italiano</italian_btn>
<portuguese_btn>portoghese</portuguese_btn>
<content_txt>ecco un esempio di quello che lei può fare con archivi di xml esterni e mx abbaglianti. clicchi su alcuna bandiera ed automaticamente tutti i campi di testo sono aggiornati a lingua purchessia che lei seleziona. il clip di film non traduce testo. legge semplicemente il testo tradotto che lei scrive nel documento di xml. poi è caricato nel suo film.</content_txt>
</content>


  5、新建一个xml文件,命名为portuguese.xml,本文件用来支持葡萄牙语,保存的格式为utf-8格式,保存的内容如下:



<?xml version="1.0" encoding="utf-8"?>
<content>
<english_btn>engels</english_btn>
<french_btn>frans</french_btn>
<spanish_btn>spaans</spanish_btn>
<german_btn>duits</german_btn>
<italian_btn>italiaans</italian_btn>
<portuguese_btn>portugees</portuguese_btn>
<content_txt>aqui é um exemplo do que você pode fazer com arquivos de xml externos e flash mx. fa?a tique-taque em qualquer bandeira e automaticamente todos os campos de texto s?o atualizados a qualquer idioma que você seleciona. o clipe de filme n?o traduz texto. lê o texto traduzido que você escreve no documento de xml simplesmente. ent?o está carregado em seu filme.</content_txt>
</content>

6、新建一个xml文件,命名为spanish.xml,本文件用来支持西班牙语,保存的格式为utf-8格式,保存的内容如下:


<?xml version="1.0" encoding="utf-8"?>
<content>
<english_btn>inglés</english_btn>
<french_btn>francés</french_btn>
<spanish_btn>espa?ol</spanish_btn>
<german_btn>alemán</german_btn>
<italian_btn>italiano</italian_btn>
<portuguese_btn>portugués</portuguese_btn>
<content_txt>aquí es un ejemplo de lo que usted puede hacer con los archivos de xml externos y llamarada mx. haga clic en cualquier bandera y automáticamente todos los campos del texto se ponen al día a idioma cualquier que usted selecciona. la grapa de la película no traduce el texto. lee el texto traducido que usted escribe en el documento de xml simplemente. entonces está cargado en su película.</content_txt>
</content>


  b、制作flash文件

  1、在flash中新建一个文件,将影片的大小设置为760 px * 200 px,背景设置为黑色。如图2所示。


  2、在场景中用文本工具拉7个文本框,类型都设置为dynamic_text,分别命名为english_btn、french_btn、spanish_btn、german_btn、italian_btn、portuguese_btn、content_txt。在场景中的摆放位置如图3所示,注意中间大的那个为content_txt。


  3、在场景的时间轴上面,新建一个层,命名为action,在action层的第一帧上面插入关键帧(插入关键帧的方法为在时间轴中用鼠标右键点击此帧,选取insert key frame即可),将帧的标签设置为english,在此帧的action面板上面添加如下内容:



content = new xml(); //注释1
content.ignorewhite = true; //注释2
content.load("xml/english.xml"); //注释3
function languageonload() { //注释4
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload; //注释5
注释1:创建一个xml对象。
  注释2:忽略xml对象中的空格。
  注释3:导入xml文档,此文档中的内容为要显示的英语内容。
  注释4:设置导入xml文档时的响应函数。在此函数中,分别设置了各个按钮所对应的文本框的显示内容。
  注释5:设置响应函数。

  4、在action层的第八帧上面插入关键帧,将帧的标签设置为french,在此帧的action面板上面添加如下内容:


content = new xml();
content.ignorewhite = true;
content.load("xml/french.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的法语内容。

  5、在action层的第八帧上面插入关键帧,将帧的标签设置为spanish,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/spanish.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的西班牙语内容。

  6、在action层的第八帧上面插入关键帧,将帧的标签设置为german,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/german.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的德语内容。

 7、在action层的第八帧上面插入关键帧,将帧的标签设置为italian,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/italian.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的意大利语内容。

  8、在action层的第八帧上面插入关键帧,将帧的标签设置为portuguese,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/portuguese.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的葡萄牙语内容。

  9、在场景中放置6个按钮,分别表示点击后显示英语、法语、德语、意大利语、葡萄牙语、西班牙语,并在表示英语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("english");
}


  在表示法语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("french");
}


 在表示德语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("german");
}

在表示意大利语的按钮的action面板上面增加如下语句:


on (release) {
gotoandstop("italian");
}


  在表示葡萄牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("portuguese");
}


  在表示西班牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("spanish");
}


  此时场景中的情况应该如图4所示。


  c、小结

  至此,实例就制作完成了,将xml文档都放置在一个名为xml的文件夹中,在flash中生成实例的swf文件,将生成的swf文件放置在跟xml文件夹同级的目录中,打开swf文件就可以看到实例效果。注意在flash中是看不到效果的,因为在flash导入不了xml文档。
如果想要支持更多的语言,只需要更换xml文档的内容就可以实现,所以应用还算是比较简单的。

  下载本教程源文件请点击这里。


  b、制作flash文件

  1、在flash中新建一个文件,将影片的大小设置为760 px * 200 px,背景设置为黑色。如图2所示。


  2、在场景中用文本工具拉7个文本框,类型都设置为dynamic_text,分别命名为english_btn、french_btn、spanish_btn、german_btn、italian_btn、portuguese_btn、content_txt。在场景中的摆放位置如图3所示,注意中间大的那个为content_txt。


  3、在场景的时间轴上面,新建一个层,命名为action,在action层的第一帧上面插入关键帧(插入关键帧的方法为在时间轴中用鼠标右键点击此帧,选取insert key frame即可),将帧的标签设置为english,在此帧的action面板上面添加如下内容:



content = new xml(); //注释1
content.ignorewhite = true; //注释2
content.load("xml/english.xml"); //注释3
function languageonload() { //注释4
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload; //注释5
注释1:创建一个xml对象。
  注释2:忽略xml对象中的空格。
  注释3:导入xml文档,此文档中的内容为要显示的英语内容。
  注释4:设置导入xml文档时的响应函数。在此函数中,分别设置了各个按钮所对应的文本框的显示内容。
  注释5:设置响应函数。

  4、在action层的第八帧上面插入关键帧,将帧的标签设置为french,在此帧的action面板上面添加如下内容:


content = new xml();
content.ignorewhite = true;
content.load("xml/french.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的法语内容。

  5、在action层的第八帧上面插入关键帧,将帧的标签设置为spanish,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/spanish.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的西班牙语内容。

  6、在action层的第八帧上面插入关键帧,将帧的标签设置为german,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/german.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的德语内容。

 7、在action层的第八帧上面插入关键帧,将帧的标签设置为italian,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/italian.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的意大利语内容。

  8、在action层的第八帧上面插入关键帧,将帧的标签设置为portuguese,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/portuguese.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的葡萄牙语内容。

  9、在场景中放置6个按钮,分别表示点击后显示英语、法语、德语、意大利语、葡萄牙语、西班牙语,并在表示英语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("english");
}


  在表示法语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("french");
}


 在表示德语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("german");
}

在表示意大利语的按钮的action面板上面增加如下语句:


on (release) {
gotoandstop("italian");
}


  在表示葡萄牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("portuguese");
}


  在表示西班牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("spanish");
}


  此时场景中的情况应该如图4所示。


  c、小结

  至此,实例就制作完成了,将xml文档都放置在一个名为xml的文件夹中,在flash中生成实例的swf文件,将生成的swf文件放置在跟xml文件夹同级的目录中,打开swf文件就可以看到实例效果。注意在flash中是看不到效果的,因为在flash导入不了xml文档。
如果想要支持更多的语言,只需要更换xml文档的内容就可以实现,所以应用还算是比较简单的。

  下载本教程源文件请点击这里。


  注释1:导入xml文档,此文档中的内容为要显示的法语内容。

  5、在action层的第八帧上面插入关键帧,将帧的标签设置为spanish,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/spanish.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的西班牙语内容。

  6、在action层的第八帧上面插入关键帧,将帧的标签设置为german,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/german.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的德语内容。

 7、在action层的第八帧上面插入关键帧,将帧的标签设置为italian,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/italian.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的意大利语内容。

  8、在action层的第八帧上面插入关键帧,将帧的标签设置为portuguese,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/portuguese.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的葡萄牙语内容。

  9、在场景中放置6个按钮,分别表示点击后显示英语、法语、德语、意大利语、葡萄牙语、西班牙语,并在表示英语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("english");
}


  在表示法语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("french");
}


 在表示德语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("german");
}

在表示意大利语的按钮的action面板上面增加如下语句:


on (release) {
gotoandstop("italian");
}


  在表示葡萄牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("portuguese");
}


  在表示西班牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("spanish");
}


  此时场景中的情况应该如图4所示。


  c、小结

  至此,实例就制作完成了,将xml文档都放置在一个名为xml的文件夹中,在flash中生成实例的swf文件,将生成的swf文件放置在跟xml文件夹同级的目录中,打开swf文件就可以看到实例效果。注意在flash中是看不到效果的,因为在flash导入不了xml文档。
如果想要支持更多的语言,只需要更换xml文档的内容就可以实现,所以应用还算是比较简单的。

  下载本教程源文件请点击这里。


  注释1:导入xml文档,此文档中的内容为要显示的西班牙语内容。

  6、在action层的第八帧上面插入关键帧,将帧的标签设置为german,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/german.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的德语内容。

 7、在action层的第八帧上面插入关键帧,将帧的标签设置为italian,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/italian.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的意大利语内容。

  8、在action层的第八帧上面插入关键帧,将帧的标签设置为portuguese,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/portuguese.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的葡萄牙语内容。

  9、在场景中放置6个按钮,分别表示点击后显示英语、法语、德语、意大利语、葡萄牙语、西班牙语,并在表示英语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("english");
}


  在表示法语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("french");
}


 在表示德语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("german");
}

在表示意大利语的按钮的action面板上面增加如下语句:


on (release) {
gotoandstop("italian");
}


  在表示葡萄牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("portuguese");
}


  在表示西班牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("spanish");
}


  此时场景中的情况应该如图4所示。


  c、小结

  至此,实例就制作完成了,将xml文档都放置在一个名为xml的文件夹中,在flash中生成实例的swf文件,将生成的swf文件放置在跟xml文件夹同级的目录中,打开swf文件就可以看到实例效果。注意在flash中是看不到效果的,因为在flash导入不了xml文档。
如果想要支持更多的语言,只需要更换xml文档的内容就可以实现,所以应用还算是比较简单的。

  下载本教程源文件请点击这里。


  注释1:导入xml文档,此文档中的内容为要显示的德语内容。

 7、在action层的第八帧上面插入关键帧,将帧的标签设置为italian,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/italian.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的意大利语内容。

  8、在action层的第八帧上面插入关键帧,将帧的标签设置为portuguese,在此帧的action面板上面添加如下内容:



content = new xml();
content.ignorewhite = true;
content.load("xml/portuguese.xml"); //注释1
function languageonload() {
_root.english_btn.text = content.firstchild.childnodes[0].firstchild;
_root.french_btn.text = content.firstchild.childnodes[1].firstchild;
_root.spanish_btn.text = content.firstchild.childnodes[2].firstchild;
_root.german_btn.text = content.firstchild.childnodes[3].firstchild;
_root.italian_btn.text = content.firstchild.childnodes[4].firstchild;
_root.portuguese_btn.text = content.firstchild.childnodes[5].firstchild;
_root.content_txt.text = content.firstchild.childnodes[6].firstchild;
}
content.onload = languageonload;
stop();


  注释1:导入xml文档,此文档中的内容为要显示的葡萄牙语内容。

  9、在场景中放置6个按钮,分别表示点击后显示英语、法语、德语、意大利语、葡萄牙语、西班牙语,并在表示英语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("english");
}


  在表示法语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("french");
}


 在表示德语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("german");
}

在表示意大利语的按钮的action面板上面增加如下语句:


on (release) {
gotoandstop("italian");
}


  在表示葡萄牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("portuguese");
}


  在表示西班牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("spanish");
}


  此时场景中的情况应该如图4所示。


  c、小结

  至此,实例就制作完成了,将xml文档都放置在一个名为xml的文件夹中,在flash中生成实例的swf文件,将生成的swf文件放置在跟xml文件夹同级的目录中,打开swf文件就可以看到实例效果。注意在flash中是看不到效果的,因为在flash导入不了xml文档。
如果想要支持更多的语言,只需要更换xml文档的内容就可以实现,所以应用还算是比较简单的。

  下载本教程源文件请点击这里。


  在表示葡萄牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("portuguese");
}


  在表示西班牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("spanish");
}


  此时场景中的情况应该如图4所示。


  c、小结

  至此,实例就制作完成了,将xml文档都放置在一个名为xml的文件夹中,在flash中生成实例的swf文件,将生成的swf文件放置在跟xml文件夹同级的目录中,打开swf文件就可以看到实例效果。注意在flash中是看不到效果的,因为在flash导入不了xml文档。
如果想要支持更多的语言,只需要更换xml文档的内容就可以实现,所以应用还算是比较简单的。

  下载本教程源文件请点击这里。


  在表示西班牙语的按钮的action面板上面增加如下语句:



on (release) {
gotoandstop("spanish");
}


  此时场景中的情况应该如图4所示。


  c、小结

  至此,实例就制作完成了,将xml文档都放置在一个名为xml的文件夹中,在flash中生成实例的swf文件,将生成的swf文件放置在跟xml文件夹同级的目录中,打开swf文件就可以看到实例效果。注意在flash中是看不到效果的,因为在flash导入不了xml文档。
如果想要支持更多的语言,只需要更换xml文档的内容就可以实现,所以应用还算是比较简单的。

  下载本教程源文件请点击这里。


  此时场景中的情况应该如图4所示。


  c、小结

  至此,实例就制作完成了,将xml文档都放置在一个名为xml的文件夹中,在flash中生成实例的swf文件,将生成的swf文件放置在跟xml文件夹同级的目录中,打开swf文件就可以看到实例效果。注意在flash中是看不到效果的,因为在flash导入不了xml文档。
如果想要支持更多的语言,只需要更换xml文档的内容就可以实现,所以应用还算是比较简单的。

  下载本教程源文件请点击这里。


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons