473,508 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling a List of XML Data into a TextArea

4 New Member
I'm planning to call a list of data from an XML file but when I duplicate the content inside the <data></data> it is not showing anything


Here's the ActionScript 3.0

Expand|Select|Wrap|Line Numbers
  1. import fl.controls.ComboBox;
  2. import fl.controls.TextArea;
  3. import fl.containers.UILoader;
  4.  
  5. //Component Style
  6. import fl.managers.StyleManager;
  7.  
  8. var xmlLoader:URLLoader = new URLLoader();
  9. var dataURL:URLRequest = new URLRequest("data.xml");
  10. xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
  11. xmlLoader.load(dataURL);
  12.  
  13. var tFormatHead:TextFormat = new TextFormat();
  14. tFormatHead.bold = true;
  15. tFormatHead.size = 12;
  16. tFormatHead.font = "Arial";
  17.  
  18.  
  19. var albumFormat:TextFormat = new TextFormat();
  20. albumFormat.font = "Arial";
  21. albumFormat.size = 12;
  22. albumFormat.bold = true;
  23.  
  24. //StyleManager.setStyle("textFormat", albumFormat);
  25.  
  26. var dataXML:XML = new XML();
  27. dataXML.ignoreWhitespace = true;
  28.  
  29. // Choose Style Drop-Down
  30. var cbStyle:ComboBox = new ComboBox; // Combobox
  31. cbStyle.x = 755;
  32. cbStyle.y = 260;
  33. cbStyle.width = 100;
  34. addChild(cbStyle);
  35.  
  36. // Choose Style
  37. var tfStyleTxt:TextField = new TextField();
  38. tfStyleTxt.x = 750;
  39. tfStyleTxt.y = 240;
  40. tfStyleTxt.autoSize = TextFieldAutoSize.LEFT;
  41. tfStyleTxt.text = "Choose Style";
  42. addChild(tfStyleTxt);
  43. tfStyleTxt.setTextFormat(tFormatHead);
  44.  
  45. var txtFldPassage:TextArea = new TextArea(); // Text Area Description
  46. txtFldPassage.x = 30;
  47. txtFldPassage.y = 120;
  48. txtFldPassage.width = 700;
  49. txtFldPassage.height = 250;
  50. txtFldPassage.editable = false;
  51. txtFldPassage.condenseWhite = true;
  52. addChild(txtFldPassage);
  53.  
  54.  
  55. var txtFldQuestions:TextArea = new TextArea(); // Text Area City
  56. txtFldQuestions.x = 30;
  57. txtFldQuestions.y = 440;
  58. txtFldQuestions.width = 600;
  59. txtFldQuestions.height = 200;
  60. txtFldQuestions.editable = false;
  61. addChild(txtFldQuestions);
  62.  
  63. var txtFldFeedback:TextArea = new TextArea(); // Text Area feedback
  64. txtFldFeedback.x = 650;
  65. txtFldFeedback.y = 440;
  66. txtFldFeedback.width = 300;
  67. txtFldFeedback.height = 200;
  68. txtFldFeedback.editable = false;
  69. addChild(txtFldFeedback);
  70.  
  71.  
  72. function xmlLoaded(evt:Event):void
  73. {
  74.     dataXML = XML(xmlLoader.data);
  75.  
  76.     for (var tripName:String in dataXML.list)
  77.     {    
  78.         cbStyle.addItem({label:dataXML.list[tripName].@style});
  79.     }
  80.     txtFldPassage.htmlText = dataXML.list[0].passage;
  81.     txtFldQuestions.text = dataXML.list[0].question;
  82.     txtFldFeedback.text = dataXML.list[0].feedback;
  83.  
  84. }
  85.  
  86. function selectStyle(evt:Event):void
  87. {
  88.     trace ("selected" + evt.target.selectedIndex);
  89.     txtFldPassage.htmlText = dataXML.list[evt.target.selectedIndex].passage;
  90.     txtFldQuestions.text = dataXML.list[evt.target.selectedIndex].question;
  91.     txtFldFeedback.text = dataXML.list[evt.target.selectedIndex].feedback;
  92.  
  93.  
  94. }
  95. cbStyle.addEventListener(Event.CHANGE, selectStyle);
  96.  

and here's the XML
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <data>
  3.   <list style="Bold">
  4.     <question>the thing that will turn into a chicken after hatching</question>
  5.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  6.     <passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  7.   </list>
  8.   <list style="Underline">
  9.     <question>a living creature that is not human</question>
  10.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  11.     <passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  12.   </list>
  13.   <list style="Bracket">
  14.     <question>small</question>
  15.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  16.     <passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  17.   </list>
  18.   <list style="Font Color ">
  19.     <question>the seeds of frogs</question>
  20.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  21.     <passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog?  This is the story of the life cycle of the frog.</passage>
  22.   </list>
  23.   <list style="All Style ">
  24.     <question>an animal that can live on land and in water</question>
  25.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  26.     <passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog?  This is the story of the life cycle of the frog.</passage>
  27.   </list>
  28. </data>
  29.  
  30. <data>
  31.   <list style="Bold">
  32.     <question>the thing that will turn into a chicken after hatching</question>
  33.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  34.     <passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  35.   </list>
  36.   <list style="Underline">
  37.     <question>a living creature that is not human</question>
  38.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  39.     <passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  40.   </list>
  41.   <list style="Bracket">
  42.     <question>small</question>
  43.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  44.     <passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  45.   </list>
  46.   <list style="Font Color ">
  47.     <question>the seeds of frogs</question>
  48.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  49.     <passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog?  This is the story of the life cycle of the frog.</passage>
  50.   </list>
  51.   <list style="All Style ">
  52.     <question>an animal that can live on land and in water</question>
  53.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  54.     <passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog?  This is the story of the life cycle of the frog.</passage>
  55.   </list>
  56. </data>
  57.  
  58.  
  59. <data>
  60.   <list style="Bold">
  61.     <question>the thing that will turn into a chicken after hatching</question>
  62.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  63.     <passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  64.   </list>
  65.   <list style="Underline">
  66.     <question>a living creature that is not human</question>
  67.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  68.     <passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  69.   </list>
  70.   <list style="Bracket">
  71.     <question>small</question>
  72.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  73.     <passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  74.   </list>
  75.   <list style="Font Color ">
  76.     <question>the seeds of frogs</question>
  77.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  78.     <passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog?  This is the story of the life cycle of the frog.</passage>
  79.   </list>
  80.   <list style="All Style ">
  81.     <question>an animal that can live on land and in water</question>
  82.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  83.     <passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog?  This is the story of the life cycle of the frog.</passage>
  84.   </list>
  85. </data>
  86.  
  87. <data>
  88.   <list style="Bold">
  89.     <question>the thing that will turn into a chicken after hatching</question>
  90.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  91.     <passage>What is a <b>baby</b> frog called? Where does it come from? How does a baby frog grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  92.   </list>
  93.   <list style="Underline">
  94.     <question>a living creature that is not human</question>
  95.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  96.     <passage>What is a baby frog called? Where does it <u>come</u> from? How does a baby frog grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  97.   </list>
  98.   <list style="Bracket">
  99.     <question>small</question>
  100.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  101.     <passage>What is a baby frog called? Where does it come from? How does a baby <i>[frog]</i> grow into an adult frog?  This is the story of the life cycle of the frog.</passage>
  102.   </list>
  103.   <list style="Font Color ">
  104.     <question>the seeds of frogs</question>
  105.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  106.     <passage>What is a baby frog called? Where does it come from? How does a baby frog grow into an <font color="#FF0000">adult</font> frog?  This is the story of the life cycle of the frog.</passage>
  107.   </list>
  108.   <list style="All Style ">
  109.     <question>an animal that can live on land and in water</question>
  110.     <feedback>I think you got the correct answer. Click the word now to confirm if this is correct</feedback>
  111.     <passage>What is a <b>baby</b> frog called? Where does it <u>come</u> from? How does a baby <i>[frog]</i> grow into an <font color="#FF0000">adult</font> frog?  This is the story of the life cycle of the frog.</passage>
  112.   </list>
  113. </data>
  114.  
Thanks in advance.
Sep 4 '08 #1
0 2267

Sign in to post your reply or Sign up for a free account.

Similar topics

5
17985
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript...
3
6231
by: Gram | last post by:
Hello, Can anyone help me with the following, or point me to a site that can help: I have a list of words in a List and I want a user to be able to select several words from this list, hit a...
4
1262
by: just1coder | last post by:
Is it possible to create a dropdown list populated by the contents of a textarea? <textarea> <a name="this">this</a> <a name="that">that</a> </textarea> Then, the dropdown would have the <a>...
4
20990
by: devine | last post by:
Hi All, I am VERY new to Javascript. I have been provided with some code, which will enable me to hide/show a text area and change a submit button dependant on a check box. <!DOCTYPE html...
4
2520
by: valeberry | last post by:
//Index.php <html><head><title>Mailing List Administration</title></head><body> <br> <center><H1>Mailing List Administration</H1></center> Send an email to a mailing list: <form method=post...
9
19815
by: Ajinkya | last post by:
Hello friends ! , I am very new to java script.If anyone can help me then I will be very very thankful to his/her. I am using php and mysql in my project and I have one textarea and one...
47
3228
by: mukeshrasm | last post by:
Hi I am calling two pages using Ajax Get_Pages.php and Get_Content.php from combo box. Both pages are displayed based on selection from combo box. Main problem is that it is not showing the...
0
2382
by: saijin | last post by:
Are there anyway that I can add a checkbox on a component that supports "dataProvider" and HTML tags? Here's what I have so far: import fl.data.DataProvider; import fl.managers.StyleManager;...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7405
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5643
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5059
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
435
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.