# Calling functions in Classes

**URL:** <https://forum.kirupa.com/t/calling-functions-in-classes/85857>\
**Category:** flash\
**Created:** [April 8, 2005, 12:03am UTC](https://forum.kirupa.com/t/calling-functions-in-classes/85857 "2005-04-08T00:03:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MTsoul](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@MTsoul](https://forum.kirupa.com/u/MTsoul)\
**Post date:** [April 8, 2005, 12:03am UTC](https://forum.kirupa.com/t/calling-functions-in-classes/85857/1 "2005-04-08T00:03:52Z")

</div>

Hey all,

I got a question. How can I direct a function in a class to an object?

Ex:

```auto
class blah {
    var server;
    function blah () {
        this.server = new XMLSocket();
        this.server.onConnect = this.connector();
        this.server.connect(null, 1234);
    }
    function connector (success) {
        trace (success);
    }
}

```

Like, that piece of code does not work. The function “connector” within that class is not assigned to the server’s onConnect function, and therefore is not called. How do i link that function to that one?

Thanks! :A+:
