Advertisement

04.24.2008 at 04:50AM PDT, ID: 23349876
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.7

comboBox and XML - AS2

Asked by mbjorge in Macromedia Flash, Extensible Markup Language (XML)

Tags:

I have populated a comboBox dynamilcally from an xml file. When a user selects an item from the comboBox, I want to search the XML nodes to the node that has the node vlaue "a name" and retrieve all the attributes of that node.  For example, if the user selects "Gyda" from the comboBox, I want to search the xml file to the node with the node value "Gyda" and display all the values for the attributes of that node on a movieClip called mcInfoBoxStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
var cbFieldList:MovieClip = this.createClassObject(mx.controls.ComboBox, "ComboBox", this.getNextHighestDepth());
 cbFieldList.enabled = true;
 cbFieldList._x = 5.3;
 cbFieldList._y = 370;
 cbFieldList._width = 150;
 cbFieldList._height = 20;
 cbFieldList.dropdownWidth = 150;
 cbFieldList.rowCount = 5;
 cbFieldList.text_mc.setStyle("borderStyle", "solid");
 cbFieldList.addItem({label:"Select Field"});
 
var currentNode:XMLNode = this.firstChild.firstChild;	
fieldNode = currentNode.nextSibling.childNodes;
function popCombo(){
 for(var i=1;i<fieldNode.length;i++){
   var nodeValue=String(fieldNode[i].firstChild.nodeValue)
   //trace("nodeValue " + nodeValue);
   cbFieldList.addItem(nodeValue);
 	
   var cbListener:Object = new Object();
   cbListener.change = function(evt_obj:Object) {
   var cbValue:String = cbFieldList.selectedItem.label;
   //trace("cbValue " + cbValue);
 
   if (nodeValue == cbValue){
   _root.mcInfoBox.txtName.text = nodeValue;
  _root.mcInfoBox.txtnpdid.text = npdid attribute value;
  _root.mcInfoBox.txtlat.text = lat attribute value; 
  _root.mcInfoBox.txtlong.text = long attribute value;
  _root.mcInfoBox.mcLink.txtartId.text = getURL("http:www.somewhere.com/" + artId attribute value;
   _root.mcInfoBox.txtimage.text = image attribute value;//display image
  _root.mcInfoBox._visible = true;
		
     }
   }
 }
cbFieldList.addEventListener("change", cbListener);
 }
 
//XML structure
<?xml version="1.0" encoding="utf-8"?>
<options>
<map>
     <coordinates maxLongN="76.7" minLongS="40.3" maxLatE="74" minLatW="-44.6">map2.jpg</coordinates>
</map>
<folder>     
  <field npdid='3437659' lat='1.533738935' long='58.64961876' artId= '524995' image=''>Enoch</field>
  <field npdid='1272071' lat='1.648069689' long='58.71138378' artId= '522083' image=''>Glitne</field>
  <field npdid='43492' lat='3.072204299' long='56.88667656' artId= '522115' image='http://web3.aftenbladet.no/multimedia/archive/00188/gyda_01_jpg_188074e.jpg'>Gyda</field>
  <field npdid='2762452' lat='5.340485143' long='63.46788343' artId= '524998' image='http://web3.aftenbladet.no/multimedia/archive/00193/ormen_lange_subsea__193986e.jpg'>Ormen 
 
Lange</field>
  <field npdid='1028599' lat='2.966068895' long='56.96919371' artId= '523418' image='http://web3.aftenbladet.no/multimedia/archive/00187/tambar_bredde_jpg_187114e.jpg'>Tambar</field>
  <field npdid='43800' lat='2.852780591' long='57.10441995' artId= '523603' image='http://web3.aftenbladet.no/multimedia/archive/00187/ula_bredde_jpg_187134e.jpg'>Ula</field>
</folder>
</options>
[+][-]04.24.2008 at 05:18AM PDT, ID: 21429944

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Macromedia Flash, Extensible Markup Language (XML)
Tags: flash AS2
Sign Up Now!
Solution Provided By: aneeshchopra
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628