Can't open an XML file

There is an xml file named:“menu.xml”. It’s path is “C:\menu.xml”.And its code is:
<menu>
<mainitem>
<item>Alphabet</item>
<subitem>A</subitem>
<subitem>B</subitem>
</mainitem>
</menu>

The actionscript written to open the file is :
myXML= new XML();
myXML.load(“C:\menu.xml”);
myXML.onLoad=loaded(success);

function loaded(success){
if(success) {trace(“Ok”);}
else {trace("! Ok");}
}

When the movie is “run” the following error occurs:
Error opening URL “C:\enu.xml”

My question:The file name is menu.xml but the error statement calls it enu.xml! Why?
Also why doesn’t the xml file load into the movie?

Please download the movie and help!

source code for the xml file is:

<menu>
<mainitem>
<item>Alphabet</item>
<subitem>A</subitem>
<subitem>B</subitem>
</mainitem>
</menu>

Well I didn’t set up any test files, but I noticed a few things wrong right off the bat…

  1. You are exporting as Flash 5, go to File/Publish Settings and click on the Flash tab and choose Flash 6. Otherwise the dynamic event handlers won’t work.

  2. myXML.load(“C:\enu.xml”)… enu.xml? Is that correct?

  3. myXML.onLoad = loaded(success)… should be myXML.onLoad = loaded

since i don’t have flash 6 i open the swf file in frhed and change it to flash player 06. then i open the file in flash player 06.(thanks to senocular,for the idea)

Oh, well if you are going through all of that, then I have no clue how to help you :-\

to lost in beta:
could you open the .fla and see what if it works for you.please do try it with an xml file of your own named menu.xml.

Yes, it worked.

I created the menu.xml file in the same directory as the .swf file (didn’t feel like going through all the addressing), then used this code…

[AS]myXML = new XML();
//added ignoreWhite
myXML.ignoreWhite = true;
myXML.load(“menu.xml”);
myXML.onLoad = loaded;
function loaded(success) {
if (success) {
trace(“Ok”);
createTextField(“xmltext1”, 1, 100, 100, 200, 200);
xmltext1.text = “Successfully Loaded!”;
} else {
trace("! Ok");
createTextField(“xmltext2”, 1, 100, 100, 200, 200);
xmltext2.text = “Unsuccessful!”;
}
}[/AS]

And when I tested the movie I got a textbox that said “Successfully Loaded!”

BTW: I added ignoreWhite in there because that is something you should always do when loading in XML. It removes all the excess/useless whitespace from the XML file.

lost, all the above xml actionscript existed in Flash 5, so no pb with that…
java, when using test movie locally, always test with any files you wanna load in the same folder as your fla/swf, lots of bugs come from there! might just be that you need to escape the \ with \… try…

Eyez: ignoreWhite and createTextField() existed in Flash 5? I thought that was introduced in MX??? :q:

not YOUR actionscript, the one he originally posted! :wink:

Oh… ok, well ignoreWhite is in MY actionscript, but createTextField is in HIS .fla file. (the one in the attachment, not the one in the thread)

:wink: :wink:

to eyez:I use most of the actionscript commands and functions in flash mx for my flash 5 files. I open frhed and convert the .swf into flash player 06 format.(thanks again senocular).

@ lost: well i did say

all the above xml actionscript existed in Flash 5
and never looked at the fla… :wink:

@javadi: does it work then now?

would be nice when you ask stuff to tell us if it’s solved or not…

Yea, im confuzzled :hangover:

I remember when sen posted the way to get Flash 5 files to act as Flash MX files so you can use the sintax, but I don’t know if it works as well, so I don’t know if this works.

So… does it?

YES YES YES.It does work! ‘It’ here implies two things:

1.Senocular’s idea of writing actionscript for flash mx in flash 5 and then changing the .swf format to flashplayer 06 WORKS.

2.I had to only change the
myXML.onLoad=loaded(success) to
myXML.onLoad=loaded as lostin beta said and IT WORKED!

Thanks for the help!