# Call to functions in a class not working

**URL:** https://forum.kirupa.com/t/call-to-functions-in-a-class-not-working/75740
**Category:** Uncategorized
**Created:** [January 11, 2005, 10:03pm UTC](https://forum.kirupa.com/t/call-to-functions-in-a-class-not-working/75740 "2005-01-11T22:03:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tofuisonmyside](https://avatars.discourse-cdn.com/v4/letter/t/58956e/32.png) [@tofuisonmyside](https://forum.kirupa.com/u/tofuisonmyside)
#### Post date: [January 11, 2005, 10:03pm UTC](https://forum.kirupa.com/t/call-to-functions-in-a-class-not-working/75740/1 "2005-01-11T22:03:41Z")

</div>

Hello !

here is the piece of code :

```auto
 
class Mp3Player {
var obj:Object;
var cXML:XML;
var playliste:String;
//
function Mp3Player(playliste:String, obj:Object) {
trace("constructor call");
this.playliste = playliste;
this.obj = obj;
init();
}
function init():Void {
trace("function init");
loadXML(onXmlLoaded);
}
function loadXML(funcOnLoaded):Void {
trace("function loadxml");
cXML = new XML();
cXML.onLoad = function(success) {
if (success) {
	funcOnLoaded.apply(this.obj, [this]);
}
};
cXML.load(this.playliste);
}
function onXmlLoaded(xmlobj) {
trace("onXmlLoaded");
xml2arr(xmlobj);
}
function xml2arr(xmlobj) {
trace("function xml2arr"); 
display(); 
}
function display() {
trace("displaying player mp3");
}
}
 

```

in my fla:

```auto
var liste = new Mp3Player("my.xml",this); 

```

the output expected:  
constructor call  
function init  
function loadxml  
onXmlLoaded  
function xml2arr  
displaying player mp3

real ouput:

```auto

constructor call
function init
function loadxml
onXmlLoaded

```

no way to see the xml2arr function nor the display function…

i do not see clearly why…  
maybe a pb with the apply (this.obj…), the scope of this.obj inside the onLoad ?

tofu
