473,545 Members | 2,639 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;
  5. //Component Style
  6. import fl.managers.StyleManager;
  8. var xmlLoader:URLLoader = new URLLoader();
  9. var dataURL:URLRequest = new URLRequest("data.xml");
  10. xmlLoader.addEventListener(Event.COMPLETE,xmlLoaded);
  11. xmlLoader.load(dataURL);
  13. var tFormatHead:TextFormat = new TextFormat();
  14. tFormatHead.bold = true;
  15. tFormatHead.size = 12;
  16. tFormatHead.font = "Arial";
  19. var albumFormat:TextFormat = new TextFormat();
  20. albumFormat.font = "Arial";
  21. albumFormat.size = 12;
  22. albumFormat.bold = true;
  24. //StyleManager.setStyle("textFormat", albumFormat);
  26. var dataXML:XML = new XML();
  27. dataXML.ignoreWhitespace = true;
  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);
  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);
  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);
  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);
  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);
  72. function xmlLoaded(evt:Event):void
  73. {
  74.     dataXML = XML(xmlLoader.data);
  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;
  84. }
  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;
  94. }
  95. cbStyle.addEventListener(Event.CHANGE, selectStyle);

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>
  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>
  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>
  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>
Thanks in advance.
Sep 4 '08 #1
0 2271

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

Similar topics

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 function and have JS put this into an array. Then JS would use this array to create a selection list which displays only the names of the drugs. When...
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 button and these words appear in a textarea. Thanks in advance for your help.
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> values as options... Please reply to
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 PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
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 action="sendemail.php3"> <table><tr><td> <b>From Address:</b> <input type=text name="From" size="40" value=""> <br>
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 list boxes,now whenever user fill any value(email-Id) to textarea and press submit button then value going to listbox. These values are one or...
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 editor which is called on the Get_Content.php. in Main Page. I have included the js files in the head section. all the files are on the same...
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; import fl.controls.List; import fl.controls.TileList; import fl.controls.TextArea;
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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 we have to send another system
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.