jimmyboo
01-13-2008, 01:03 AM
Hi,
I am trying to figure out how to throw a custom event from an object that is the child of another object such that the parent object can catch it. Basically, I have two classes, Gallery and Image. Each instance of the Gallery contains an array of Image objects. The Image class contains a method to load a jpg using the Loader class, to which I have assigned an event listener for the Event.COMPLETE event (added to the contentLoaderInfo property of Loader class).
What I want to do is, when the COMPLETE event is thrown by any instance of the Image class, I want the parent Gallery class to catch it. Does anyone have any idea of how to do this? I gather that I have to create a custom Event class, but I'm not quite show how to assign a listener in the Gallery class to events thrown by the child Image objects. Thanks in advance!
J
I am trying to figure out how to throw a custom event from an object that is the child of another object such that the parent object can catch it. Basically, I have two classes, Gallery and Image. Each instance of the Gallery contains an array of Image objects. The Image class contains a method to load a jpg using the Loader class, to which I have assigned an event listener for the Event.COMPLETE event (added to the contentLoaderInfo property of Loader class).
What I want to do is, when the COMPLETE event is thrown by any instance of the Image class, I want the parent Gallery class to catch it. Does anyone have any idea of how to do this? I gather that I have to create a custom Event class, but I'm not quite show how to assign a listener in the Gallery class to events thrown by the child Image objects. Thanks in advance!
J