Javascript Object Binding Problem

Open Firebug and use the object myo for testing.

use myo.test() to run the AJAX call for the test function that fails.

The problem is that "this" in this.doAnotherAction() is being called inside of the XMLHttpRequest.onreadystatechange() function, causing "this" to reference onreadystatechange() or the XMLHttpRequest object instead of object "myo" of class Obj. I've tried many points of binding but cannot seem to locate the proper place to bind the call to function this.doAnotherAction() to recognize "this" as "myo".

Note that I am trying to use a hybrid constructor/prototype paradigm to make use of the single reference to functions and eventually arrays of elements, so i can control the behavior of changing elements and their events from one referenced location, instead of multiple copies of elements and their event handlers, or worse, event handlers attached to elements that no longer exist!

View the test.js file

AJAX Response: