# TypeError: Error #1006: value is not a function

**URL:** https://forum.kirupa.com/t/typeerror-error-1006-value-is-not-a-function/326304
**Category:** Uncategorized
**Created:** [December 6, 2011, 9:58am UTC](https://forum.kirupa.com/t/typeerror-error-1006-value-is-not-a-function/326304 "2011-12-06T09:58:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Igor\_Rolim](https://avatars.discourse-cdn.com/v4/letter/i/f4b2a3/32.png) [@Igor\_Rolim](https://forum.kirupa.com/u/Igor_Rolim)
#### Post date: [December 6, 2011, 9:58am UTC](https://forum.kirupa.com/t/typeerror-error-1006-value-is-not-a-function/326304/1 "2011-12-06T09:58:36Z")

</div>

Dear All,

Please help!!!

I got this errors:

```auto
TypeError: Error #1006: value is not a function.
	at videos_fla::MainTimeline/xmlloaded()
	at flash.events::EventDispatcher/dispatchEventFunction()
	at flash.events::EventDispatcher/dispatchEvent()
	at flash.net::URLLoader/onComplete()

```

When I try to run this code below (Could you all please help?):

```auto
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE,xmlloaded);

var xml:XML = new XML();
var amountofvid:Number=0;
var currentvideo:Number=0;

L_btn.addEventListener(MouseEvent.CLICK, prevvid);
R_btn.addEventListener(MouseEvent.CLICK, nextvid);

function xmlloaded(e:Event) {
	xml=XML(e.target.data);
	amountofvid=xml.video.lenght()-1;
	changevid();
}

function nextvid(e:Event) {
	currentvideo++;
	changevid();
}

function prevvid(e:Event) {
	currentvideo--;
	changevid();
}

function changevid():void {
	var cv:Number=Math.abs (currentvideo);
	
	if (cv>amountofvid) {
		currentvideo=cv=0;
	}
	if (currentvideo<0) {
		currentvideo=cv=amountofvid;
	}
	t_txt.text=xml.video.@title[cv];
	vid.source=xml.video.@src[cv];
	
}

loader.load(new URLRequest("video.xml"))

```

Looking forward to hearing from you.

Best Regards,

Igor R.
