-
Event Listener Without Object
I am wondering if there is a way to attach an event listener to something other then an object? What I currently have is an event listener that is activated when object 'mc' is loaded. I would like to have the event list to activate without having it tied to an object. Is this possible?
Code:
mc.addEventListener(Event.ACTIVATE, loadChild);
function loadChild(e:Event){
...function...
}
-
No, what would it even mean? What would dispatch the event?
-
That was what I was thinking. From my understanding, an event listener needs to be attached to an object.
I remember from AS2 that there was something like onMovieLoad(doThis). Does this or something like that exist in AS3?
-
Having never done much with AS2, I don't know what that code would do. Which movie load would trigger it?
In AS3, you can add a listener for Event.COMPLETE to the Loader/LoaderInfo which loads the movie you are interested in.
Or you can add a listener in the constructor of the loaded movie itself, probably for Event.ADDED_TO_STAGE or to that movie's loaderInfo for Event.COMPLETE (same object as going through the Loader from outside).
-
Thank you. I'll look into Loader/LoaderInfo
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|