Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 599077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:27:30+00:00 2026-05-13T16:27:30+00:00

I have an event listener applied to an xml load and it currently traces

  • 0

I have an event listener applied to an xml load and it currently traces out the values it grabs which is fine, but what I want it to do is return an array for me to use. I have the Array creation and return working from “LoadXML” (it returns the array) but I can’t get this to work with an event listener.

The event listener runs the “LoadXML” function fine, but I have no idea how to take the returned array for use, this is an example of how my event listener works right now:

xmlLoader.addEventListener(Event.COMPLETE, LoadXML());

and my assumption of how I would take the array (this doesn’t work):

var rArray:Array = xmlLoader.addEventListener(Event.COMPLETE, LoadXML());

so instead I tried the following:

xmlLoader.addEventListener(Event.COMPLETE, function():Array{
    var rData:Array = LoadXML(datahere);
    return rData;
}

but that doesn’t worth either.

So: How do I return an array from an eventlistener? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:27:31+00:00Added an answer on May 13, 2026 at 4:27 pm

    I think there is some confusion of how event listeners work. Actually, I’m surprised your not getting compile errors with your current code.

    When adding an event listener, what you should be passing in is a reference to a function to be called at a later time. Then when that function gets called, it will pass an Event object with any retrived data for working with. Here is a example:

    xmlLoader.addEventListener(Event.COMPLETE, handleLoadComplete/*Note: No brackets, this is a reference*/);
    
    //will be called at a later time, not instantly.
    function handleLoadComplete(e:Event):void {
        var xml:XML = xmlLoader.data as XML;
        //do what ever you want this the XML...
    }
    

    Hopefully that makes things clearer for you.

    Happy Coding!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have a jQuery.event listener, which once triggers will display an otherwise hidden
This one's driving me crazy... I have a loop which adds an event listener
Currently, I have a JList listen to list selection listener. private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt)
I have written the following function which adds an event listener and registers the
I want to have a single event listener for multiple events and depending on
I have an event listener which performs fadeIn and fadeOut on some images when
I have an event listener (for Audit Logs) which needs to append audit log
I have a map marker to which I've added an event listener. when I
I have a predicament: I want to send some data with an event listener
Is it possible to have keyboard event listener canvas.addEventListener('onkeydown', ev_keydown, false); like we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.