# Hardtyped Variables not searching prototype \[MX2K4\]

**URL:** <https://forum.kirupa.com/t/hardtyped-variables-not-searching-prototype-mx2k4/165105>\
**Category:** flash\
**Created:** [October 7, 2005, 6:26pm UTC](https://forum.kirupa.com/t/hardtyped-variables-not-searching-prototype-mx2k4/165105 "2005-10-07T18:26:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandall](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@Brandall](https://forum.kirupa.com/u/Brandall)\
**Post date:** [October 7, 2005, 6:26pm UTC](https://forum.kirupa.com/t/hardtyped-variables-not-searching-prototype-mx2k4/165105/1 "2005-10-07T18:26:33Z")

</div>

I’m attemping to add some functions to the XMLNode class (more specifically functions to make the calling of XPath functions easier).

I’ve got an .as file which includes this code:

```auto

MLNode.prototype.getXMLAttribute = function(XPath:String, attributeName:String):String {
	return com.xfactorstudio.xml.xpath.XPath.selectSingleNode(this,XPath).attributes[attributeName];
}

```

Now, I’ve got another .fla file from which I’m calling these from with this code:

```auto
#include "initialization.as"

var settings_xml:XML = new XML();

settings_xml.ignoreWhite = true;
settings_xml.load("set.xml");

settings_xml.onLoad = function() {
	test = this.firstChild;
	if (test instanceof XMLNode) trace("YEAAA");
	trace(test.getXMLAttribute("logos/biglogo","path"));
}

```

Now this code will work fine, but if I try to preset the test variable type for ‘test’ I got an error. So if I add a ling of code directly after the settings\_xml definition like this:

**var test:XMLNode;** or **var test:XMLNode = new XMLNode();**

and then try to compile I get the following error:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 12: There is no method with the name ‘getXMLAttribute’.  
trace(test\_xmlNode.getXMLAttribute(“logos/biglogo”,“path”));

Why is it that as soon as I try to hard type the variable, it stops searching the prototype object for functions?
