# Calling function problems

**URL:** <https://forum.kirupa.com/t/calling-function-problems/36189>\
**Category:** Uncategorized\
**Created:** [November 23, 2003, 3:14pm UTC](https://forum.kirupa.com/t/calling-function-problems/36189 "2003-11-23T15:14:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bobaphatt](https://avatars.discourse-cdn.com/v4/letter/b/ce73a5/32.png) [@bobaphatt](https://forum.kirupa.com/u/bobaphatt)\
**Post date:** [November 23, 2003, 3:14pm UTC](https://forum.kirupa.com/t/calling-function-problems/36189/1 "2003-11-23T15:14:09Z")

</div>

hey, i’m having a strange problem:  
i set a function:

MovieClip.prototype.thumbLoadbar = function(a) {  
trace(“hello”)  
var t = \_root.thumbtotal;  
var l = \_root.thumbloaded;  
\_root.thumbloaded += a;  
trace(l);  
getPercent = (l/t);  
if (t\>0) {  
\_root.thumbbar.\_width = getPercent_110;  
\_root.thumbText.text = Math.round(getPercent_100)+"%";  
}  
if (t\>0 && t == l) {  
trace(“loaded”);  
}  
};

and call this function with this clip in wich a JPG is being loaded:

onClipEvent (load) {  
l = this.getBytesLoaded();  
t = this.getBytesTotal();  
p = this;

```
if (t&gt;0 && t == l) {
	w = p._width/-2;
	h = p._height/-2;
	p._x = w;
	p._y = h;
	_root.thumbLoadbar(t);
	trace("bytes = "+ t);
}

```

}

now, with this set-up the function thumbloadbar is called, but ofcourse the data (t) sent the first time is not the data from the JPG (2500 bytes) but from the empty clip (12 bytes).  
the function is only called while the bytes dont exceed 12 bytes, when it gets more, it just doesnt call it anymore for some reason, but the “IF” action does still work(because it still traces ("bytes = "+t)), so it should just call the function, shouldnt it? When i change onClipEvent(load) to (data), the function is not called at all  
whats wrong with my script?
