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 5838405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:27:52+00:00 2026-05-22T11:27:52+00:00

AS3 I’m trying to dynamically load pictures based on XML file. The problem that

  • 0

AS3

I’m trying to dynamically load pictures based on XML file. The problem that Im stuck with is a function that is supposed to return found node from supplied identifier.
Like in the following code

function getStudyById(id:String):XMLNode{
    var xl:XMLList = xml.bacase.(@name==id); // xml is a global variable
    return xl.children()[0]; // xl[0] does not work either
    // return (xl.length()>0) ? xl[0] : null;
}

The XML goes like this:

<root>
    <bacase name="a" />
    <bacase name="b" />
</root>

Anticipating your questions, it all is done in the COMPLETE event of the xml loader, once the XML has been loaded.

Now the problem is that the XMLList appears to be empty, while xml is correctly populated and the identifier definitely matches one of the nodes.
When I duplicate the queried node, the list traces correctly as containing two nodes. So my guess is that, if there is only a single match, the XMLList does not get created, and the result contains data of XMLNode data type.

Anyone there to confirm this? If so, is there a way to ensure that the query always returns XMLList type?

Thanks
Artur

  • 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-22T11:27:52+00:00Added an answer on May 22, 2026 at 11:27 am

    XMLNode works only with the old flash.xml.XMLDocument. A single node would be of type XML if you use XML or XMLList.

    This snipped works fine for me:

    var xml:XML = <root>
            <bacase name="a" />
            <bacase name="b" />
        </root>;
    
    var p:XMLList = xml.bacase.(@name == "a");
    
    if (p.length() > 0) return XML(p[0]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in AS3, I'm making this dynamic textfield that is populated from an XML file
In AS3 i've created a code that load a sound and execute it in
My AS3 Flash loads some file that is a JSON with some special characters
I have an AS3 program that calls a function multiple times. The function must
I've got an as3 function that controls a movie clip with the keyboard: package
I have this AS3 slideshow code, that loads an XML with a list of
(Flash Professional / AS3) I have a main fla file that loads a game
in AS3 I'm trying to load a URL (a Yahoo address) into the application
In AS3 you have a function on a string with this signature: function replace(pattern:*,
In as3, is there a utility or function to convert an RGB color (e.g.

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.