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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:52:54+00:00 2026-05-24T19:52:54+00:00

My XML looks as follows <?xml version=1.0 encoding=utf-8?> <Images> <Image imgID = 1 >

  • 0

My XML looks as follows

<?xml version="1.0" encoding="utf-8"?>
<Images>
<Image imgID = "1" >
        <imgName>"Angelina Jolie"</imgName>
            <url>"Angelina Jolie.jpg"</url> 
</Image>

<Image imgID = "2" >
    <imgName>"Big B"</imgName>
    <url>"Big B.jpg"</url>
</Image>

<Image imgID = "3" >
     <imgName>"Brad Pitt"</imgName>
     <url>"Brad Pitt.jpg"</url> 
</Image>

<Image imgID = "4" >
    <imgName>"Mohanlal"</imgName>
    <url>"Mohanlal.jpg"</url>
</Image>

<Image imgID = "5" >
    <imgName>"Prithviraj"</imgName>
    <url>"Prithviraj.jpg"</url>
</Image>
<Image imgID = "6" >
    <imgName>"Tom Cruise"</imgName>
    <url>"Tom Cruise.jpg"</url>
</Image>
</Images>

In my folder I have the XML as shown. There are 6 images in the folder and the names are given as urls. I have a combo box on stage. Its name myCB. There is an image holder imgHolder_mc.

I have two tasks.

Populate the combo box with the imageNames.

Based on the imageName selected the image in the image holder must change. The image must be retrieved using the image url.

This is what I have did so far

import fl.data.DataProvider;

myCB.prompt = "Select Image:";
var model_dp:DataProvider = new DataProvider(xmlData);
myCB.dataProvider = model_dp;



// Creates the variable(s) to load the XML externally
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();

// Ensuring that we do not prematurely start fiddling with the XML data until all of our data has been loaded
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
// We call our xmlLoader's load method
xmlLoader.load(new URLRequest("Images.xml"));

function LoadXML(e:Event):void {
    xmlData = new XML(e.target.data);
    trace(xmlData..imgName);  

}

The trace gives me

<imgName>"Angelina Jolie"</imgName>
<imgName>"Big B"</imgName>
<imgName>"Brad Pitt"</imgName>
<imgName>"Mohanlal"</imgName>
<imgName>"Prithviraj"</imgName>
<imgName>"Tom Cruise"</imgName>

Please advice me as how I can bind this to my combo box and select images according to the selection I made in combo box.

  • 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-24T19:52:55+00:00Added an answer on May 24, 2026 at 7:52 pm
    myCB.prompt = "Select Image";
    var xmlLoader:URLLoader = new URLLoader();
    var xmlData:XML = new XML();
    var xmlAry:Array = new Array();
    var xmlURL:Array = new Array();
    xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
    xmlLoader.load(new URLRequest("Images.xml"));
    function LoadXML(e:Event):void {
        xmlData = new XML(e.target.data);
        trace(xmlData..imgName.length());
        for(var i:uint=0;i<xmlData..imgName.length();i++)
        {
            xmlAry.push(xmlData..imgName[i]);
            xmlURL.push(xmlData..url[i]);
            myCB.addItem( { label: xmlAry[i], data:i } );
            myCB.addEventListener(Event.CHANGE, action);
        }
    }
    function action (e:Event):void 
    {
        var no:Number = Number(myCB.selectedItem.data);
        trace(xmlURL[no]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have an XML file which looks like this: <?xml version=1.0 encoding=UTF-8?> <Project
Consider the following HTML markup: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
What is the below animation supposed to do? <?xml version=1.0 encoding=utf-8?> <rotate xmlns:android=http://schemas.android.com/apk/res/android android:fromDegrees=0
I have a simple xml below: <?xml version=1.0 encoding=utf-8?> <catalogue> <category name=textbook id=100 parent=books>
I have a XML code like this: <?xml version=1.0 encoding=utf-8 ?> <Window xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml>
My XML looks like : <?xml version=\1.0\?> <itemSet> <Item>one</Item> <Item>two</Item> <Item>three</Item> .....maybe more Items
My xml looks like this: <nodes><skus><sku>abc</sku><sku>def123</sku></skus></nodes> I want to get all the elements with
My xml looks like: <nodes> <node name=somekey> <item name=subject>blah</item> <item name=body>body</item> </node> </nodes> And
I want to transform an XML document. The source XML looks like this: <svc:ElementList>
my xml structure looks like this: <entity id=1000070> <name>apple</name> <type>category</type> <entities> <entity id=7002870> <name>mac</name>

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.