How do I add a 'onRelease' function to loaded mc's

Hi! Could anyone take a look at my code. It only displays a square.


testClass = new Object();
testClass.childClass = new Object();

function doTest() {
    _root.attachMovie("empty_mc", "container", 0);
    
    testClass.test = _root.container;

    // Hmm.. Am I right on this? If I were to write code in Java equivalent to this, would that code be like:
    // obj_name = new testClass.childClass()
    testClass["obj_name"] = new testClass["childClass"]();
    // But the thing is that, the testClass object holds the newly created "obj_name" in it. Am I right?

    // Just attaches it to _root. Voila! It shows on the stage.
    testClass.test.attachMovie("square_mc", testClass["obj_name"], 1);
}

doTest();

How can I add an ‘onRelease’ function to the childClass?
I tried this:

testClass.childClass.onRelease = function() {
trace("onRelease called");
}

Doesn’t work…

Help please?