  | |  | Re: EventDispatcher 1 frame delay | Re: EventDispatcher 1 frame delay
2004-02-17 - By Muzak
Back Hmm, donno if that 's any better tho.
Especially when multiple events need to be dispatched.
I think in that case I 'd prefer to use a setInterval for the init method (once), rather than for each dispatchEvent.
function BasicClass(){
__initID = setInterval(this, "init ", 0);
}
function init(){
clearInterval(__initID);
dispatchEvent({type: "init "});
}
kind regards,
Muzak
-- -- Original Message -- --
From: "Ahmet Zorlu " <ahmetzorlu@(protected) >
To: <flashcoders@(protected) >
Sent: Tuesday, February 17, 2004 3:45 PM
Subject: [Flashcoders] Re: EventDispatcher 1 frame delay
> afaik, you may use setInterval as an alternative to *doLater* function used in UIComponent class.
>
> <code >
> import mx.events.EventDispatcher;
>
> class BasicClass extends MovieClip
> {
> private static var _eventInit = EventDispatcher.initialize(BasicClass.prototype);
> var addEventListener:Function;
> var removeEventListener:Function;
> var dispatchEvent:Function;
> private var _interval;
>
> function BasicClass()
> {
> init();
> }
>
> private function init()
> {
> _interval = setInterval(this, "_dispatchInitEvent ", 0);
> }
>
> private function _dispatchInitEvent()
> {
> dispatchEvent({type: "init "});
> clearInterval(_interval);
> }
> }
> </code >
>
> // A.Zorlu
> // Web developer
>
> --
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Supported by Fig Leaf Software
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
Be sure to check the archives and the wiki:
http://chattyfig.figleaf.com/
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:104486
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |