问题
In Flash CS4, I've got a project that's working with a lot of XML. Previously, it's all been working fine, but recently I'm getting warnings like this when trying to compile:
Warning: 3594: toXMLString is not a recognized method of the dynamic class XML.
Warning: 3594: appendChild is not a recognized method of the dynamic class XML.
The lines of code that these errors refer to are:
stream.writeUTFBytes(currentXML.toXMLString());
and
currentXML.appendChild(marker.getXML());
"stream" is a FileStream object and "currentXML" is an XML object. "marker" is an instance of my own class, which I have imported, but I'm pretty sure that's not related.
As I've said it's only happening now. I don't see anything in my code that could have changed it. Even if I turn the changes into comments, I still get errors.
In addition to these two I am also getting other warnings, although all of them concern a method "not being recognized" in the XML class.
I am using Flash Pro CS4 and am coding on the first frame of the timeline, as opposed to in a Document Class. Oh, and I'm making an AIR app, not a Flash Player one.
回答1:
It was a problem in my other code. I had MovieClip in which I hadn't imported a necessary class, and it was giving me errors. These came along with the XML ones, but seemed unrelated. However, these were apparently causing the XML errors because once I fixed these, the XML ones disappeared. I received a few variable declaration warnings after that, but they were quickly fixed.
So if anyone else has a similar problem, try and fix any other errors you have first.
来源:https://stackoverflow.com/questions/5841957/as3-toxmlstring-and-other-methods-not-recognized