  | |  | EventDispatcher 1 frame delay | EventDispatcher 1 frame delay
2004-02-17 - By Phil Chung
Back Muzak,
What does the implementation code look like? Without seeing it, my immediate guess might be that since you have to set up a listener for the event, and the listener has to be set up after the class is initialized (AFAIK), the listener for this event isn 't in place when the initial event is dispatched via your init function (and that 's why it works when you run in after 1 frame).
Phil
Original Message:
>From: "Muzak " <p.ginneberge@(protected) >
>To: <flashcoders@(protected) >
>Subject: [Flashcoders] EventDispatcher 1 frame delay
>Date: Tue, 17 Feb 2004 09:25:28 +0100
>I just noticed that when using EventDispatcher, it takes one frame to get it to work properly.
>
>The following doesn 't work:
>
>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;
> //
> function BasicClass() {
> init();
> }
> function init() {
> dispatchEvent({type: "init "});
> }
>
>while the following does:
>
>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;
> //
> function BasicClass() {
> this.onEnterFrame = function(){
> init();
> delete this.onEnterFrame
> }
> }
> function init() {
> dispatchEvent({type: "init "});
> }
>
>
>Anyone know how to get it to work properly without using onEnterFrame?
>In other words, is there a way to avoid the frame delay?
>
>kind regards,
>Muzak
>
>
>
>=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
>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:104407
>=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
>To unsubscribe send a blank e-mail to:
>Normal Mode: flashcoders-unsubscribe@(protected)
>Digest Mode: flashcoders-digest-unsubscrive@(protected)
>
>
>
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
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:104469
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --
To unsubscribe send a blank e-mail to:
Normal Mode: flashcoders-unsubscribe@(protected)
Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|
 |