Event Handlers and Callbacks: Best way to handle?


i'm writing actionscript class. i'm wondering how deal call backs , event handlers within class. in particular, i'm wondering how might structure class developers using can choose arguments passed callback function code. i've been googling , haven't found particularly useful information on this.

as far can tell, appear parameters passed callback function determined @ time write class anonymous function example illustrates.
var myobj:object = new myclass('foo', 'bar');
myobj.onload = function(arg) {
// args passed anonymous function dictated actionscript defnining myclass
};

i have seen approach using named functions , class method setting event handler allows developer pass object used scoping named function results in parameters callback being predetermined actionscript defines class
function myload(arg) {
// args passed function dictated actionscript defining myclass
}
var myobj:object = new myclass('foo', 'bar');
myobj.setonloadhandler(this, 'myload');


as far can tell, neither approach let developer specify parameters callback functions (onload() in first example, myload() in second example). of these approaches considered 'best practice'? also, if wanted specify callback should operate on particular movieclip on timeline? how can pass movieclip's parameter callback function?



More discussions in ActionScript 1 and 2


adobe

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums