Flash DelayedInitializer

[ 2007-05-03 18:19:06 | Author: liuhuan ]
Font Size: Large | Medium | Small
An easy way to make delay in flash, using a DelayedInitializer class.

Download:
Click Here To Download
Quote
class DelayedInitializer {
  function DelayedInitializer() {
  }
  function start(p_testObj, p_testFunc, p_handlerObj, p_handlerFunc, delaytime) {
    var delayobj = {};
    delayobj.testObj = p_testObj;
    delayobj.testFunc = p_testFunc;
    delayobj.handlerObj = p_handlerObj;
    delayobj.handlerFunc = p_handlerFunc;
    delayobj.iv = setInterval(this, "doCheck", delaytime, delayobj);
  }
  function doCheck(o) {
    if (o.testObj[o.testFunc] != undefined) {
      clearInterval(o.iv);
      o.handlerObj[o.handlerFunc]();
    }
  }
}
Usage:
Quote
function init() {
  delayedInitializer = new DelayedInitializer();
  delayedInitializer.start(this, test, this, "onComponentInit", 600);
}
function onComponentInit() {
  test._x = 60;
  test._y = 160;
}
init();
Comments Feed Comments Feed: http://www.liuhuan.com/blog/feed.asp?q=comment&id=759

There is no comment on this article.

You can't post comment on this article.