changing languages layout problem

  • Hi Guys,


    I always come here when I loose almost a day trying to make things work as I expect them to.


    I have this situation:

    I have a 3 languages layout.

    Each language button when selected, have it's opacity at "1" and when not selected, at "0.5".

    I created an action that calls the layout of each language when clicking on the desired language.

    So.... this is the action:


    Code
    <action name="change_alpha_flag"> 
    set(plugin[btn_language1].alpha, 0.5); 
    set(plugin[btn_language2].alpha, 0.5); 
    set(plugin[btn_language3].alpha, 0.5); 
    wait(blend); 
    set(plugin[%1].alpha, 1); 
    </action>


    I than created an action to change each language layout:


    Code
    <action name="change-layout-en"> 
    set(plugin[menu].url, %SWFPATH%/menu-en.gif); 
    set(plugin[show-map].url, %SWFPATH%/menu-map-en.png); 
    set(plugin[show-images].url, %SWFPATH%/menu-images-images-en.png); 
    set(plugin[menu-background].url, %SWFPATH%/menu-background-en.png); 
    
    
    if(plugin[btn_english].alpha == 1, infotext-en, infotext-es); 
    </action>


    Here is the language button:


    Code
    <plugin name="btn_spanish" 
    style="moduly_style" 
    url="%SWFPATH%/btn_spain.png" 
    alpha="0.5" 
    onhover="showtext(Español,STYLE1);" 
    x="80" 
    onclick="change_alpha_flag(btn_spanish); action(change-layout-es);" />


    Here are some problems:

    Some of the panos have a textbox that has 3 txt entries (1 for each language).

    When I click each button, all layout structure and languages texts (textbox and other things) changes with no problems.

    Considering I created for each one an action like: change-layout-en...... change-layout-es........ change-layout-pt

    How can I select spanish language button (for example), then click into another panorama and keep this language selected?
    It's restarting to the main language (language1).


    I opted to keep="false" on most plugins cause they don't appear in all panoramas.


    Considering that when clicking on the language buttons I have the layout changed perfectly with all texts and images updated, I decided to create this code:


    Code
    <event onxmlcomplete="keep-layout" 
    
    
    <action name="keep-layout"> 
    if(plugin[btn_language1].alpha == 1, change-layout-en, ); 
    if(plugin[btn_language2].alpha == 1, change-layout-pt, ); 
    if(plugin[btn_language3].alpha == 1, change-layout-es, ); 
    
    
    </action>


    BUT... it didn't work.
    What's wrong with my structure? Am I thinking it wrong?


    Another question:
    I had an image that's a menu.
    This menu has several children.
    I couldn't update the url of this menu image (to change to another language text) cause it gone on top of all children when clicking on the languages buttons to change layout.

    I tryed to insert a zorder command and it made no effect.


    Code
    set(plugin[menu].url, %SWFPATH%/menu-background-en.gif); 
    set(plugin[menu].zorder, 0);


    What happens to the plugins and children when an action changes its url?

    Well... I think it got a little complicated to explain.

    If you couldn't understand, please let me know.

    I'm really getting crazy with it! :)

    Thanks!!!!!!!!!!!!!!!!!!

    Daniel

  • Hi!!

    Your navigation tool is awesome!!
    Loved that ring with degrees! :)

    well... i couldn't see you code, but I have no problem with the onhover (showtext). It keeps while changing languages and entering other panos with no problems.
    The problem is the layout changes (image url changes).

    Ex: I have a menu that is written as an image "open menu" in english and "abrir el menu" in spanish. All graphics.
    When clicking on the language buttons, the images of that menu changes with no problems, but when entering another pano, the images get back to original. All showtext keep in that selected language, but the images are "reset".

    Any clue? Any idea to work with?

    THanks!!!!!

    Daniel

  • I think is the same with the help's images

    Images

    Buttons

    Actions

    Language Button

  • Hello,


    I'm getting crazy!!!!

    I decided to write all language code again.


    The Language Buttons:


    Some panos have a text box with info.
    Here is the problem.
    When clicking on the buttons, all texts are show correctly.
    If I select spanish language and change pano, the textbox show portuguese text.
    Portuguese and english are shown correcly, even when changing between panos.


    This is the action to load textbox data:

    Code
    <action name="textbox-info">
      if(language == english,set(plugin[text2].html,data:data-en));
      if(language == spanish,set(plugin[text2].html,data:data-es));
      if(language == portugues,set(plugin[text2].html,data:data-br));
       </action>



    I suppose the error is inside the textfield itself.. i tryed several approaches.. but I'm really about to give up this code and come back to the 2 languages layout.

    Thanks for reading and your help!!

    Daniel

  • Thank you Steve!!

    Several days ago I saw that code, but understood absolutely nothing! :)

    Today I think it'll be easier to understand it!!
    I already read it, but need to take a deep look to adapt it to my needs.


    Just a point:


    How should I insert this code?



    I tried inside xml.It returns XML Parser Error: Element is malformed (#1090).

    I put it inside the index html and nothing happened... it looks like it weren't there.

    I know this looks stupid by my side... but could you please give me this first guideline?

    Thank you!

    Daniel

  • Thank you Steve!!
    How should I insert this code?


    Daniel

    That's javascript, not xml. You can put it in a file called kr_languages.js and then load it by putting the following line in the body of your html:

    Code
    <script type="text/javascript" src="kr_languages.js"></script>

    steve

  • Thank you Steve!!!
    This works fine!!!!

    I´ll update my layout structure with these codes!

    THANK YOU!!!!!!!!!!!!!!

    Can I use this code to have a button onclick get the xml of my tour?
    Supose user wants to send an e-mail of that xml or even send it to any social network..
    how could be the code for something similar to "get(xml url)" and send an e-mail? :)

    Sorry if it looks stupid question, but these steps are now beyond my poor knowledge. I swear I will learn it in a near future! :)

    Thanks again!!

    Daniel

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!