Hi,
Your dispathing class may have those elements:

// before your class declaration
import mx.events.EventDispatcher

// I your properties declaration
public var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;

// In your init method, or constructor
EventDispatcher.initialize(this);

// In your method where your want the event to be dispatched
this.dispatchEvent({type:"PanelMove",direction:"open"});
// you can add all objetc properties you want... "type" is looked to identify wich event has been dispatched, all other props will be your parameters



Then in your listening class, just add:
// In your listening method (mcPanelClip is an occurence from the dispatching class, here a movieclip)
this.fListeningFunc = Delegate.create(this,OnPanelMove);
mcPanelClip.addEventListener("PanelMove",this.fListeningFunc);

// The method wich receives the event
pirvate funtion OnPanelMove(obj:Object):Void
{
    trace (obj.direction)
    // all your params were transmitted through this "obj" object
}


++
PR



hidayath q a écrit :

can anyone tell me.How to use DispatchEvent in AS2.0 class.

Iike to to dispath an event from one class to another class which will have
addEventListener to handle the event.

Can anyone give a small example and explanation.

Regards.
S.Hidayath
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to