Illegal function help..simplify xml import

Hello,

For an application I’m making I need some dedicated xml import. To simplify this import I want to have a function (because I need a repetitive process). The only thing is that I want to change parameters inside a xml string as well. All in all my function does not work. I’ve added the code below. The function I’m talking about is:

function checkPercentage(intPer:Number, textfield, xmlText):void

var intPer1:Number = 30;
var intPer2:Number = 60;

function showXML(event:MouseEvent)
{
	var intent_xml:XML;
	var xmlReq:URLRequest = new URLRequest("intent.xml");
	var xmlLoader:URLLoader = new URLLoader();

	function checkPercentage(intPer:Number, textfield, xmlText):void
	{
		if(intPer < 33){
			textfield.text = intent_xml.xmlText.low;
		}else if(intPer < 66){
			textfield.text = intent_xml.xmlText.medium;
		}else{
			textfield.text = intent_xml.xmlText.high;
		}
	}

	function dataLoaded(event:Event):void
	{
		intent_xml = new XML(xmlLoader.data);
		//give proper description for low/medium/high 
		checkPercentage(intPer1, intentI_txt, intent_I);
		checkPercentage(intPer2, intentII_txt, intent_II);
			
	}
	
	xmlLoader.addEventListener(Event.COMPLETE, dataLoaded);
	xmlLoader.load(xmlReq);
}

process_btn.addEventListener(MouseEvent.CLICK, showXML);

Can someone point me in the right direction?