... var o:Device = this; XML.onLoad = function() { o.loaded = true; o.onLoad(); }; ... public function onLoad() { ... }