mx.utils.Delegate: more useful every day

Posted on Saturday 7 May 2005

The alternative form of setInterval for classes is:


setInterval(instance, 'functionName', time);
 

It seems to work intermittently in some circumstances, if you have a complicated class layout. In addition, the second parameter does not get checked by the compiler, so if you misspell it it can take a while to spot. You can get rid of those issues using the ever useful mx.utils.Delegate:


import mx.utils.Delegate;
setInterval(Delegate.create(instance, function), time);
 

'this' will be correct in the called function and you'll get a warning if you try to reference a function that doesn't exist. Thanks Mike!


WordPress database error: [Can't open file: 'wp_comments.MYD'. (errno: 145)]
SELECT * FROM wp_comments WHERE comment_post_ID = '91' AND comment_approved = '1' ORDER BY comment_date

No comments have been added to this post yet.

Leave a comment




Your e-mail address is never displayed. If you run into issues with SpamKarma blocking you, email me at $patrick->5etdemi(com)


RSS feed for comments on this post | TrackBack URI