7 Replies Latest reply on Jul 4, 2007 9:37 AM by kglad

    Delay addEventListener?

    Keehunthebeginner Level 1
      Hello,
      Anyways, I have this code (attached at the bottom)
      I was wondering, in the function completeHanlder, I do a return statement. In the first function where the eventListener is and calls the second function, completeHandler, how do a access the return value for completeHandler? I could put a variable equal to the function but that wouldn't work since the function requires the event parameter which I think, only a addEventListener can properly pass.

      Is this possible?
      Thank you very much.

      Keehun Nam
        • 1. Re: Delay addEventListener?
          kglad Adobe Community Professional & MVP
          why do you need a return value from loadFrom? why not trigger the use of output when loading is complete in completeHandler?
          • 2. Delay addEventListener?
            Keehunthebeginner Level 1
            i can't. I'm writing a custom class.
            When I did that (hard code a text field to change to "output"), it did work perfectly however, I don't know now which text fields to change text of, even if I want to do that.

            Now, that's up to the user of this custom class (which I just erased from the example and left you the core pieces) to use the DATA RETURNED from the custom class to any way s/he chooses to use it as.

            I'm pretty sure its possible...
            • 3. Re: Delay addEventListener?
              kglad Adobe Community Professional & MVP
              you edited the code in your message and my comment and your message make no sense. in addition, your code has an obvious error in completeHandler where you've coded a return string and a void return.

              if you're trying to communicate the value of output (after loading is complete) to an object that's in your class scope you can attach a listener to your object and dispatch a custom event from completeHandler.
              • 4. Delay addEventListener?
                Keehunthebeginner Level 1
                kglad. I'm sorry.
                I am trying to oversimplify the code on this forum. In my flash, I did edit the "void" into true return types and everything is correct. And sorry about that edit. I really need this solved, and this topic is already on 3 forums (here, kirupa, and gotoandlearn). I guess I need more patience. However, please just look at the very general terms of the code. I will edit the code again to fix the things you have pointed out.

                Could I use a Dispatch? I heard about it but I have no clue how its done.
                • 5. Re: Delay addEventListener?
                  kglad Adobe Community Professional & MVP
                  you can use dispatchevent, but i don't know if that will help you. does the object that needs to use output exist in your class'es scope? if yes, dispatchevent will help.
                  • 6. Re: Delay addEventListener?
                    Keehunthebeginner Level 1
                    How about using a custom event class?
                    Jeez. I didn't know trying to pass back some values from a function called from an eventListener couldn't be this hard!
                    • 7. Re: Delay addEventListener?
                      kglad Adobe Community Professional & MVP
                      that won't get the event out of your class scope, if that's the problem.