I’ve been having problems with what I think is the default xml namespace directive. I have created a simple example of the problem…
// TestClass.as
package {
public class TestClass {
private var _testVar:String;
public function TestClass() {
var testXML:XML = <node1 xmlns="http://www.testurl.com/"><node2><node3>some words of wisdom</node3></node2></node1>;
default xml namespace = testXML.namespace("");
_testVar = testXML.node2.node3;
}
public function get testVar():String {
return _testVar;
}
}
}
// Test.fla - frame 1
import TestClass;
var myTestClass:TestClass = new TestClass();
var someVar:String = myTestClass.testVar;
trace(someVar);
I get the following error…
verify TestClass/get testVar()
stack:
scope: [global Object$ TestClass$]
locals: TestClass
0:getlocal0
stack: TestClass
scope: [global Object$ TestClass$]
locals: TestClass
1:pushscope
stack:
scope: [global Object$ TestClass$] TestClass
locals: TestClass
2:getlocal1
VerifyError: Error #1025: An invalid register 1 was accessed.
at TestClass/get testVar()
at Test_fla::MainTimeline/Test_fla::frame1()
However if I take out the default xml namespace directive, and use the following code, it works fine.
var testNS:Namespace = new Namespace(testXML.namespace(""));
_testVar = testXML.testNS::node2.testNS::node3;
Thoughts??? It’s driving me crazy. Thanks in advance…
levi