Flash DelayedInitializer
[ 2007-05-03 18:19:06 | Author: liuhuan ]
An easy way to make delay in flash, using a DelayedInitializer class.
Download:
Click Here To DownloadUsage:
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]();
}
}
}
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]();
}
}
}
Quote
function init() {
delayedInitializer = new DelayedInitializer();
delayedInitializer.start(this, test, this, "onComponentInit", 600);
}
function onComponentInit() {
test._x = 60;
test._y = 160;
}
init();
delayedInitializer = new DelayedInitializer();
delayedInitializer.start(this, test, this, "onComponentInit", 600);
}
function onComponentInit() {
test._x = 60;
test._y = 160;
}
init();
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.