Avatar billede plastic.gangsta Nybegynder
07. juni 2004 - 12:04 Der er 16 kommentarer og
1 løsning

vedr. specificering af bestemt sprog ved multi-lingual flash film

Hej,

Jeg har lavet en flash præsentation på 5 forskellige sprog - dette har jeg gjort via multi-lingual funktionen i Flash MX 2004 hvor jeg har anvendt Strings panelet.

Nu har jeg så læst mig frem til at flash har indsat en kode der gør at hvis en tysker går ind på min præsentation vil han se den tyske version og hvis en dansker går ind vil han se den danske version. Dette er også glimrende, jeg ønsker bare at lave lidt om  idet.

Jeg har nemlig lavet en introduktions-menu hvor man skal kunne vælge det sprog man gerne vil se præsentationen på.

Kan scripte det således at man selv kan vælge hvilket sprog det skal fungere på -  det må være noget med at man kæder filen sammen med en bestemt .XML fil (hvert sprog har hver sin .XML fil)


Hilsen

//Jens
Avatar billede nikolajdu Nybegynder
07. juni 2004 - 12:10 #1
var xml_du = new XML ();
xml_du.onLoad = function (s) {
    if (s) {
trace("hurra");
    }
};
sprog1.onRelease = function(){
xml_du.load ("fil1.xml");
}
sprog2.onRelease = function(){
xml_du.load ("fil2.xml");
}

sprog3.onRelease = function(){
xml_du.load ("fil3.xml");
}


sprog4.onRelease = function(){
xml_du.load ("fil4.xml");
}

sprog5.onRelease = function(){
xml_du.load ("fil5.xml");
}
stop();

;-)
Avatar billede plastic.gangsta Nybegynder
07. juni 2004 - 12:12 #2
hvor kommer selve .swf filens navn så ind... er det hurra?
Avatar billede nikolajdu Nybegynder
07. juni 2004 - 12:17 #3
Jeg gik ud fra at du allerede havde din .swf fil inde.

Hvis det er fordi du også vilde loade forskellige .swf filer så prøv med noget alá :

var xml_du = new XML ();
xml_du.onLoad = function (s) {
    if (s) {
        trace ("hurra");
    }
};
load_language = function (fil) {
    xml_du.load (fil+".xml");
    loadMovie(fil+".swf",1)
};
sprog1.onRelease = function () {
    load_language ("dansk");
};
sprog2.onRelease = function () {
    load_language ("engelsk");
};
sprog3.onRelease = function () {
    load_language ("tysk");
};
sprog4.onRelease = function () {
    load_language ("swahili");
};
sprog5.onRelease = function () {
    load_language ("polsk");
};
stop ();
Avatar billede plastic.gangsta Nybegynder
07. juni 2004 - 12:41 #4
det er fordi menuen ligger i en anden .swf en der hvor præsentationen ligger..jeg prøver lige og ser hvad der sker
Avatar billede plastic.gangsta Nybegynder
07. juni 2004 - 13:56 #5
den første løsning som du skitserede, er den som jeg nok skal bruge, men den dur ikke.

Jeg har lavet den lidt om så den ser såldes ud:

var xml_du = new XML ();
xml_du.onLoad = function (s) {
    if (s) {
trace("hurra");
    }
};
sprog1.onRelease = function(){
xml_du.load ("de/TSE_corpor_de.xml");
nextScene();

}
sprog2.onRelease = function(){
xml_du.load ("en/TSE_corpor_en.xml");
nextScene();
}

sprog3.onRelease = function(){
xml_du.load ("es/TSE_corpor_es.xml");
nextScene();
}


sprog4.onRelease = function(){
xml_du.load ("fr/TSE_corpor_fr.xml");
nextScene();
}

sprog5.onRelease = function(){
xml_du.load ("dk/TSE_corpor_dk.xml");
nextScene();
}
stop();


variablen xml_du : skal man specificere den andre steder ?
Hvordan ved flash at den xml vi loader ind lige præcist tilhører sprog strengene....?
Avatar billede plastic.gangsta Nybegynder
07. juni 2004 - 13:57 #6
sådan her ser .xml filen ud til det engelske sprog hvis det kan hjælpe:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xliff PUBLIC "-//XLIFF//DTD XLIFF//EN"

"http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" >

<xliff version="1.0" xml:lang="en">

  <file datatype="plaintext" original="TSE_corpor.fla" source-language="EN">
    <header></header>
    <body>
      <trans-unit id="001" resname="IDS__A">
        <source>A</source>
      </trans-unit>
      <trans-unit id="002" resname="IDS_ADVANTAGE">
        <source> Advantage</source>
      </trans-unit>
      <trans-unit id="003" resname="IDS_BESTPRATICES1">
        <source>Best</source>
      </trans-unit>
      <trans-unit id="004" resname="IDS_BESTPRATICES2">
        <source>Practices</source>
      </trans-unit>
      <trans-unit id="005" resname="IDS_BESTVALUE1">
        <source>Best</source>
      </trans-unit>
      <trans-unit id="006" resname="IDS_BESTVALUE2">
        <source>Value</source>
      </trans-unit>
      <trans-unit id="007" resname="IDS_BUS">
        <source>Bus</source>
      </trans-unit>
      <trans-unit id="008" resname="IDS_COMMERCIALCARRIERS">
        <source>Commercial Carriers</source>
      </trans-unit>
      <trans-unit id="009" resname="IDS_COMMUNITY">
        <source>Community</source>
      </trans-unit>
      <trans-unit id="010" resname="IDS_COMMUNITYORGANISATIONS">
        <source>Community Organisations</source>
      </trans-unit>
      <trans-unit id="011" resname="IDS_CUSTOMSOLUTIONS1">
        <source>Custom</source>
      </trans-unit>
      <trans-unit id="012" resname="IDS_CUSTOMSOLUTIONS2">
        <source>Solutions</source>
      </trans-unit>
      <trans-unit id="013" resname="IDS_DEMANDRESPONSE1">
        <source>Demand</source>
      </trans-unit>
      <trans-unit id="014" resname="IDS_DEMANDRESPONSE2">
        <source>Response</source>
      </trans-unit>
      <trans-unit id="015" resname="IDS_EVERYDAY">
        <source>Everyday</source>
      </trans-unit>
      <trans-unit id="016" resname="IDS_EXPERIENCE">
        <source>experience</source>
      </trans-unit>
      <trans-unit id="017" resname="IDS_FIXEDROUTE1">
        <source>Fixed </source>
      </trans-unit>
      <trans-unit id="018" resname="IDS_FIXEDROUTE2">
        <source>Route</source>
      </trans-unit>
      <trans-unit id="019" resname="IDS_FLEXIBLEROUTE1">
        <source>Flexible    </source>
      </trans-unit>
      <trans-unit id="020" resname="IDS_FLEXIBLEROUTE2">
        <source>Route</source>
      </trans-unit>
      <trans-unit id="021" resname="IDS_HEALTHMEDICAL">
        <source>Health &amp; Medical</source>
      </trans-unit>
      <trans-unit id="022" resname="IDS_HELPSMOVE">
        <source>helps move</source>
      </trans-unit>
      <trans-unit id="023" resname="IDS_IMPLEMENTATIONANDSUPPORT1">
        <source>Implementation</source>
      </trans-unit>
      <trans-unit id="024" resname="IDS_IMPLEMENTATIONANDSUPPORT2">
        <source>    &amp; Support </source>
      </trans-unit>
      <trans-unit id="025" resname="IDS_IMPROVEDSERVICES1">
        <source>Improved</source>
      </trans-unit>
      <trans-unit id="026" resname="IDS_IMPROVEDSERVICES2">
        <source>Services</source>
      </trans-unit>
      <trans-unit id="027" resname="IDS_INCREASEDPRODUCTIVITY1">
        <source>Increased</source>
      </trans-unit>
      <trans-unit id="028" resname="IDS_INCREASEDPRODUCTIVITY2">
        <source>Productivity</source>
      </trans-unit>
      <trans-unit id="029" resname="IDS_INNOVATIVEPRODUCTS1">
        <source>Innovative</source>
      </trans-unit>
      <trans-unit id="030" resname="IDS_INNOVATIVEPRODUCTS2">
        <source>Products</source>
      </trans-unit>
      <trans-unit id="031" resname="IDS_INTEGRATEDSOLUTIONS1">
        <source>  Integrated </source>
      </trans-unit>
      <trans-unit id="032" resname="IDS_INTEGRATEDSOLUTIONS2">
        <source>Solutions</source>
      </trans-unit>
      <trans-unit id="033" resname="IDS_LIGHTRAIL">
        <source>Lightrail</source>
      </trans-unit>
      <trans-unit id="034" resname="IDS_LOCALGOVERNMENT">
        <source>Local Government</source>
      </trans-unit>
      <trans-unit id="035" resname="IDS_MILLIONSOFPEOPLE">
        <source>              millions of people</source>
      </trans-unit>
      <trans-unit id="036" resname="IDS_MOBILE COMPUTING">
        <source>Mobile Computing</source>
      </trans-unit>
      <trans-unit id="037" resname="IDS_MOREEFFICIENCY1">
        <source>More</source>
      </trans-unit>
      <trans-unit id="038" resname="IDS_MOREEFFICIENCY2">
        <source>Efficiency</source>
      </trans-unit>
      <trans-unit id="039" resname="IDS_OF">
        <source>of</source>
      </trans-unit>
      <trans-unit id="040" resname="IDS_OPERATIONS">
        <source>Operations</source>
      </trans-unit>
      <trans-unit id="041" resname="IDS_PASSENGER INFORMATION">
        <source>Passenger Information</source>
      </trans-unit>
      <trans-unit id="042" resname="IDS_PLANNING">
        <source>Planning</source>
      </trans-unit>
      <trans-unit id="043" resname="IDS_RAIL">
        <source>Rail</source>
      </trans-unit>
      <trans-unit id="044" resname="IDS_REGIONALGOVERNMENT">
        <source>Regional Government</source>
      </trans-unit>
      <trans-unit id="045" resname="IDS_REPORTING">
        <source>Reporting</source>
      </trans-unit>
      <trans-unit id="046" resname="IDS_ROUTING">
        <source>Routing</source>
      </trans-unit>
      <trans-unit id="047" resname="IDS_SCHEDULING">
        <source>Scheduling</source>
      </trans-unit>
      <trans-unit id="048" resname="IDS_SCHOOL">
        <source>School</source>
      </trans-unit>
      <trans-unit id="049" resname="IDS_SOCIALSERVICES">
        <source>Social Services</source>
      </trans-unit>
      <trans-unit id="050" resname="IDS_TECHNOLOGYFORBETTERTRANSPORT1">
        <source>Technology for</source>
      </trans-unit>
      <trans-unit id="051" resname="IDS_TECHNOLOGYFORBETTERTRANSPORT2">
        <source>Better Transport</source>
      </trans-unit>
      <trans-unit id="052" resname="IDS_THE">
        <source>The                  </source>
      </trans-unit>
      <trans-unit id="053" resname="IDS_TRANSPORTEXPERTISE1">
        <source>Transport</source>
      </trans-unit>
      <trans-unit id="054" resname="IDS_TRANSPORTEXPERTISE2">
        <source>Expertise</source>
      </trans-unit>
      <trans-unit id="055" resname="IDS_TRAPEZE">
        <source>Trapeze</source>
      </trans-unit>
      <trans-unit id="056" resname="IDS_WORLD">
        <source>World</source>
      </trans-unit>
    </body>
  </file>

</xliff>
Avatar billede plastic.gangsta Nybegynder
07. juni 2004 - 14:23 #7
i en fil på flashkit der laver noget af det samme har jeg fundet følgende:

//    Actionscripter : Ed Reyes 2002 / ED REYES DESIGN STUDIO (c) 2002
/*
    XML Setup - Very Important part of the whole movie. Basically these three
    lines tie the flash movie with the external .xml file located in the
      XML folder and initiates the image viewer once the movie is fully loaded.
      The .xml document can be placed anywhere as long as you create the right
      directory path in the statement [ content.load("xml/english.xml") ].
 
      XML Coding - the statement [ content.ignoreWhite = true; ] basically
      tells flash that if this PROPERTY is set to true, text nodes that only
      contain white space are discarded during the parsing process. Text nodes
      with leading or trailing white space are unaffected.
 
      For more information on XML visit - http://www.xml.com
*/
//
content = new XML();
content.ignoreWhite = true;
content.load("xml/english.xml");
//
/*     Create a function to extract the text attributes from each childNode in the
    XML file and associate it with each text instance that contains a dynamic
    text field within the flash movie.
*/       
function languageOnLoad() {
//    -root. {references the top level hierarchy of this flash movie}
//    .english_btn. {references the instance name given to the dynamic text label for the US flag}
//    .text = {references the attribute for the dynamic text field of the instance name and associates it with the variable for the new XML() content}
//    content. {references the information from the english.xml file and gets the appropriate data for each childNode}
//    .firstChild.childNodes[0].firstChild; {references the firstChild found within the <CONTENT></CONTENT> tags of the XML document}
//    [0],[1],[2],[3],[4],[5],[6] is the order of the childNodes in which it appears as its own specified tag contained within the <CONTENT></CONTENT> tags}
//
//
//    !! IMPORTANT !!
//    How this relates to the XML file [ english.xml ]
//
//    <CONTENT>
    _root.english_btn.text = content.firstChild.childNodes[0].firstChild;
//    <english_btn>English</english_btn>
    _root.french_btn.text = content.firstChild.childNodes[1].firstChild;
//    <french_btn>French</french_btn>
    _root.spanish_btn.text = content.firstChild.childNodes[2].firstChild;
//    <spanish_btn>Spanish</spanish_btn>
    _root.german_btn.text = content.firstChild.childNodes[3].firstChild;
//    <german_btn>German</german_btn>
    _root.italian_btn.text = content.firstChild.childNodes[4].firstChild;
//    <italian_btn>Italian</italian_btn>
    _root.portuguese_btn.text = content.firstChild.childNodes[5].firstChild;
//    <portuguese_btn>Portuguese</portuguese_btn>
    _root.content_txt.text = content.firstChild.childNodes[6].firstChild;
//    <content_txt>Here is an example of what you can do with external XML files and Flash MX. Click on any flag and automatically all the text fields are updated to whatever language you select. The movie clip does not translate text. It simply reads the translated text you write in the XML document. Then it is loaded into your movie.</content_txt>
//    </CONTENT>
//
}
/*     When the user clicks on a flag and is on this frame. [ content.onload ]
    tells flash to load the appropriate external XML language file and
    associate the variables/elements/attributes (the text for the languages
    and content area) within that file to the function [ lanugageOnLoad ]
    which displays the text in the language that was selected.
*/
content.onLoad = languageOnLoad;
//     Stops the movie timeline on this frame
stop();
Avatar billede nikolajdu Nybegynder
07. juni 2004 - 15:39 #8
Hvis ikke du kan trace "hurra" inde i flash så er det fordi stien til din xml er forkert.
Avatar billede plastic.gangsta Nybegynder
08. juni 2004 - 09:18 #9
den tracer sådan set fint nok - jeg får ihvertifald min hurra besked  --> at den loader .xml filen rigtigt nok ind.

Problemet er bare at den ikke ændre sproget i selve præsentationen --> den .xml fil som vi loader ind bliver ikke opfattet som tekst filen. Ligegyldigt hvilken .xml fil vi loader ind (Spansk,Dansk,Tysk,Fransk) så er præsentationen altid på default sproget, Engelsk) altså denne .xml fil --> en/TSE_corpor_en.xml

på en eller anden måde skal vi have gjort således at de andre erstatter denne - har du nogen forslag?
Avatar billede nikolajdu Nybegynder
08. juni 2004 - 09:32 #10
Så vil jeg hellere se en flashfilm der laver præcist det du gør - for hvis filen bliver loadet korrekt så må i lave noget andet halløj?
Avatar billede plastic.gangsta Nybegynder
08. juni 2004 - 09:37 #11
kan det have noget at gøre at man udover at give de dynamiske tekststrenge et navn i stringspanelet - at de også skal have et variable eller instance navn?
Avatar billede plastic.gangsta Nybegynder
08. juni 2004 - 09:50 #12
mange tak for det - hvad er din adresse?
Avatar billede nikolajdu Nybegynder
08. juni 2004 - 10:01 #13
nikolajdu3@hotmail.com - Husk at zippe 2 xml filer med.
Avatar billede plastic.gangsta Nybegynder
08. juni 2004 - 10:26 #14
er sendt
Avatar billede plastic.gangsta Nybegynder
09. juni 2004 - 12:51 #15
Nikolajdu- kunne du give mig nogle hints til hvordan jeg kan komme igang med at få lavet min sprogversion styring - hvad mangler der? hvor kan jeg søge oplysninger ?
Avatar billede nikolajdu Nybegynder
09. juni 2004 - 13:04 #16
Har ikke tid nu - Smider lidt hjælp senere på dagen.
Avatar billede plastic.gangsta Nybegynder
22. august 2004 - 14:10 #17
lukker
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester