I have a problem using function hasChildNodes() in ActionScript2. Here is the link where I read about that function:
I expose in detail my problem.
So first I have an xml document that I attach here:
http://flyupload.flyupload.com/get?fid=7321293
Ok.
Now the contents of my fla file(on frame1 I put this actionscript code). Put the two files in one folder.
So create a fla file and paste this code:
// incarca document XML cu nume specificat in FLASH
// cream instanta cu numele xmldocument pt.clasa XML
// xmldocument este un obiect ce apartine clasei XML
var xmldocument:XML = new XML()
// setam proprietate ignoreWhite la true
xmldocument.ignoreWhite = true;
xmldocument.onLoad = function(succes:Boolean):Void
{// variabila succes specifica dk documentul XML a fost incarcat
if(succes)
// definim o variabila pt.nodul radacina numita xmlRoot
{var xmlRoot:XMLNode = this.firstChild;
//referinta la tag-ul titlu -variabila xmlTitlu
var xmlTitlu:XMLNode = xmlFirstItem.firstChild;
var xmlFirstItem:XMLNode = xmlRoot.firstChild;
if (xmlRoot.hasChildNodes())
{trace("We have child nodes in XML File");
else trace("No child nodes in XML File");
}
//avem un singur nod radacina numit <elementradacina>
}
}
//load the xml file in Flash
xmldocument.load("elementradacina.xml");
And here is my error on this line:
else trace("No child nodes in XML File");
The error :
'else' encountered without matching 'if'
How I can rewrite my code to get rid of that error?
I want to load my xml file into flash and to display a message if my xml file has child nodes or not using hasChildNodes method.