A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Event Listener Without Object

  1. #1

    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...
    }
    ~~~~~jOn waZ hErE~~~~~

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    No, what would it even mean? What would dispatch the event?

  3. #3
    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?
    ~~~~~jOn waZ hErE~~~~~

  4. #4
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    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).

  5. #5
    Thank you. I'll look into Loader/LoaderInfo
    ~~~~~jOn waZ hErE~~~~~

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center