Multi-language website (5006 error)

Hi,

I’m new here and I’m new to AS(3).
I’m trying to make a multi-language website with XML. Here is my code:
ActionScript Code:

    
[LEFT]package [COLOR=#000000]{[/COLOR]
    [COLOR=#000000]**var**[/COLOR] xmlData:[COLOR=#0000ff]XML[/COLOR];
    [COLOR=#000000]**var**[/COLOR] xmlLoader:URLLoader = [COLOR=#000000]**new**[/COLOR] URLLoader[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];

    xmlLoader.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000080]COMPLETE[/COLOR], LoadXML[COLOR=#000000])[/COLOR];
    xmlLoader.[COLOR=#0000ff]load[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]**new**[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#ff0000]"nederlands.xml"[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR];

    [COLOR=#000000]**function**[/COLOR] LoadXML[COLOR=#000000]([/COLOR][COLOR=#0000ff]e[/COLOR]:Event[COLOR=#000000])[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]
        xmlData = [COLOR=#000000]**new**[/COLOR] [COLOR=#0000ff]XML[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]e[/COLOR].[COLOR=#0000ff]target[/COLOR].[COLOR=#0000ff]data[/COLOR][COLOR=#000000])[/COLOR];
        page1.[COLOR=#000080]txt_home_titel[/COLOR].[COLOR=#0000ff]text[/COLOR] = xmlData.[COLOR=#0000ff]home[/COLOR].[COLOR=#000080]titel[/COLOR];
        page1.[COLOR=#000080]txt_home_tekst[/COLOR].[COLOR=#0000ff]text[/COLOR] = xmlData.[COLOR=#0000ff]home[/COLOR].[COLOR=#000080]tekst[/COLOR];
    [COLOR=#000000]}[/COLOR]

    nl_btn.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR], taalNederlands[COLOR=#000000])[/COLOR];
    en_btn.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR], taalEngels[COLOR=#000000])[/COLOR];

    [COLOR=#000000]**function**[/COLOR] taalNederlands[COLOR=#000000]([/COLOR][COLOR=#0000ff]e[/COLOR]:MouseEvent[COLOR=#000000])[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]
        xmlLoader.[COLOR=#0000ff]load[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]**new**[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#ff0000]"nederlands.xml"[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR]
    [COLOR=#000000]**function**[/COLOR] taalEngels[COLOR=#000000]([/COLOR][COLOR=#0000ff]e[/COLOR]:MouseEvent[COLOR=#000000])[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]
        xmlLoader.[COLOR=#0000ff]load[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]**new**[/COLOR] URLRequest[COLOR=#000000]([/COLOR][COLOR=#ff0000]"engels.xml"[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR]

    volgende_btn.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR], volgende[COLOR=#000000])[/COLOR];
    [COLOR=#000000]**function**[/COLOR] volgende[COLOR=#000000]([/COLOR][COLOR=#0000ff]e[/COLOR]:MouseEvent[COLOR=#000000])[/COLOR]:[COLOR=#0000ff]void[/COLOR] [COLOR=#000000]{[/COLOR]
        [COLOR=#0000ff]nextFrame[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
    [COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]

[/LEFT]

It works, as long as I put it on the timeline. The only problem then is that I can’t change the language when I’m on frame 2.
Someone advised me to put it in an extern AS file, but when I do that I get the following error:
5006: An ActionScript file can not have more than one externally visible definition: xmlData, xmlLoader

I don’t really know what that means, I hope somebody can help me out. :slight_smile:

Also I’d like to know if this is the best way to make a multi-language website in Flash?