This works...
A method in Main.as sets up my objects:
for (n=0;n<disks.length;n++) {
disks[n].startListening();
disks[n].addEventListener(SystemEvent.CHECK_ANSWERS,OptionArray.answerListener);
}
A static (or class) method in OptionArray.as ready to receive:
public static function answerListener(e:SystemEvent):void {
var hi:int=2; // **
}
A method in disk.as notifies of an event:
dispatchEvent(new SystemEvent(SystemEvent.CHECK_ANSWERS,false,true,null));
We land up here **
John
[EMAIL PROTECTED] wrote:
The AS3 event framework still leaves me slightly puzzled.
For one, I'm not sure why there's no EventListener class, or why they
didn't name EventDispatcher something else, like EventProxy or
EventBiatch, anyway, ignore that - I'll layout a question. Let's say
you have 5 classes, all of which extend Sprite:
(1)Main (2)Layout (3)PanelTop (4)PanelButton (5)DataManager
Now let's say the following exists:
A. Main contains an instance of Layout. Layout contains an instance of
PanelTop. PanelTop contains an instance of PanelButton (ie: Main -
Layout - PanelTop - PanelButton)
B. Main also contains an instance of DataManager (ie: Main - DataManager)
C. Within the PanelTop class, the instance of PanelButton is listening
for a MouseEvent (click). The handler for this event is a method
within PanelTop that creates a new custom event and then dispatches
the event.
SO here is my first question:
HOW does the DataManager class listen for this event (which is created
and dispatched from within PanelTop)?. DOES the DataManager class have
to contain an instance of either PanelTop or PanelButton? If so (which
I think is the case), you may see why I don't quite understand the
event framework.
Anyway, we'll see if anyone can advise on this for starters.
CHeers,
SF.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders