# AS3: Conditional statement only reading the final else!

**URL:** <https://forum.kirupa.com/t/as3-conditional-statement-only-reading-the-final-else/286131>\
**Category:** flash\
**Created:** [April 10, 2009, 3:08pm UTC](https://forum.kirupa.com/t/as3-conditional-statement-only-reading-the-final-else/286131 "2009-04-10T15:08:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wuzzi2ya](https://avatars.discourse-cdn.com/v4/letter/w/e79b87/32.png) [@wuzzi2ya](https://forum.kirupa.com/u/wuzzi2ya)\
**Post date:** [April 10, 2009, 3:08pm UTC](https://forum.kirupa.com/t/as3-conditional-statement-only-reading-the-final-else/286131/1 "2009-04-10T15:08:45Z")

</div>

In this conditional statement (listed below), only the ending else is being populated, regardless of the url being selected. Within the code below the “content/PT.xml” is being displayed. Both my AS3 statement and html are posted. Does anyone see an error that I am overlooking.  
Thanks for all the help!

AS3:

```auto
var keyStr:String;
    var myUrl:String;
    var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
    for (keyStr in paramObj) {
        myUrl = String(paramObj[keyStr]);
    }
    var xmlFile = "index-EN.html";
    if (myUrl == "index-EN.html") {
        xmlFile = "content/EN.xml";
        trace("EN");
    } else if (myUrl == "index-FR.html") {
        xmlFile = "content/FR.xml";
        trace("FR");
    } else {
        xmlFile = "content/PT.xml";
        trace("PT");
    }
    var xmlLoader:URLLoader = new URLLoader();
    var xmlData:XML = new XML();

    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

    xmlLoader.load(new URLRequest(xmlFile));

    function LoadXML(e:Event):void {
        trace("LoadXML");
        xmlData = new XML(e.target.data);
        ParseContent(xmlData);
    }

```

HTML (aptly named index-EN.html):

```auto
<body>
<SCRIPT LANGUAGE="JavaScript">
<!--
var currenturl = 'index-EN.html';
document.write(
    '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
'+
    'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0"
'+
    'width="540" height="360" id="Hilti360" align="middle">
'+
    '<param name="allowScriptAccess" value="*" />
'+
    '<param name="allowFullScreen" value="false" />
'+
    '<param name="movie" value="HiltiCallouts.swf" />
'+
    '<param name="quality" value="high" />
'+
    '<param name="bgcolor" value="#ffffff" />
'+
    '<param name="FlashVars" value="myVar=' + currenturl +'">
'+
      '<embed src="HiltiCallouts.swf" quality="high" bgcolor="#ffffff" width="540" height="360" name="Hilti360"
'+
    'align="middle" allowScriptAccess="sameDomain" allowFullScreen="false"
'+
    'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
'+
    '</object>
')
//-->
</SCRIPT>
</noscript>
</body>

```
