473,322 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Checkbox on XML List

4
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:

Expand|Select|Wrap|Line Numbers
  1. import fl.data.DataProvider;
  2. import fl.managers.StyleManager;
  3. import fl.controls.List;
  4. import fl.controls.TileList;
  5. import fl.controls.TextArea;
  6.  
  7. import fl.controls.ComboBox;
  8.  
  9.  
  10. var currentCategory:int;
  11. var currentItem:int;
  12.  
  13. var tFormatHead:TextFormat = new TextFormat();
  14. tFormatHead.bold = true;
  15. tFormatHead.size = 12;
  16. tFormatHead.font = "Arial";
  17.  
  18.  
  19. // Choose Style Drop-Down
  20. var cbStyle:ComboBox = new ComboBox; // Combobox
  21. cbStyle.x = 755;
  22. cbStyle.y = 260;
  23. cbStyle.width = 100;
  24. addChild(cbStyle);
  25.  
  26. // Choose Style
  27. var tfStyleTxt:TextField = new TextField();
  28. tfStyleTxt.x = 750;
  29. tfStyleTxt.y = 240;
  30. tfStyleTxt.autoSize = TextFieldAutoSize.LEFT;
  31. tfStyleTxt.text = "Choose Style";
  32. addChild(tfStyleTxt);
  33. tfStyleTxt.setTextFormat(tFormatHead);
  34.  
  35.  
  36. var txtFldPassage:List = new List(); // Text Area Description
  37. txtFldPassage.x = 30;
  38. txtFldPassage.y = 120;
  39. txtFldPassage.width = 700;
  40. txtFldPassage.height = 250;
  41. txtFldPassage.allowMultipleSelection = true;
  42. txtFldPassage.verticalLineScrollSize = 50;
  43. addChild(txtFldPassage);
  44.  
  45.  
  46.  
  47. var txtFldFeedback:TextArea = new TextArea(); // Text Area feedback
  48. txtFldFeedback.x = 650;
  49. txtFldFeedback.y = 440;
  50. txtFldFeedback.width = 300;
  51. txtFldFeedback.height = 200;
  52. txtFldFeedback.editable = false;
  53. addChild(txtFldFeedback);
  54.  
  55.  
  56. var txtFldQuestions:TextArea = new TextArea(); // Text Area Questions
  57. txtFldQuestions.x = 30;
  58. txtFldQuestions.y = 440;
  59. txtFldQuestions.width = 600;
  60. txtFldQuestions.height = 200;
  61. txtFldQuestions.editable = false;
  62. addChild(txtFldQuestions);
  63.  
  64.  
  65. var catalogFormat:TextFormat = new TextFormat();
  66. catalogFormat.font = "Verdana, Arial, Helvetica";
  67. catalogFormat.size = 11;
  68. catalogFormat.bold = true;
  69.  
  70. StyleManager.setStyle("textFormat", catalogFormat);
  71.  
  72. var productsURL:URLRequest = new URLRequest("products.xml");
  73. var xmlLoader:URLLoader = new URLLoader(productsURL);
  74. xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
  75.  
  76. var productsXML:XML = new XML();
  77. productsXML.ignoreWhitespace = true;
  78.  
  79. function xmlLoaded(evt:Event):void {
  80.     productsXML = XML(xmlLoader.data);
  81.     trace(productsXML);
  82.     var aCategory:Array = new Array();
  83.     for (var category:String in productsXML.category) {
  84.         var categoryName:String = productsXML.category[category].@name;
  85.         aCategory.push(categoryName);
  86.     }
  87.     var dpCategory:DataProvider = new DataProvider(aCategory);
  88.     cbStyle.dataProvider = dpCategory;
  89. }
  90.  
  91. function selectCategory(evt:Event):void {
  92.     currentCategory = evt.target.selectedIndex;
  93.     var aImages:Array = new Array();
  94.     for (var item:String in productsXML.category[currentCategory].item) {
  95.         var itemLabel:String = productsXML.category[currentCategory].item[item].name;
  96.         //var itemImage:String = "thumbs/"+productsXML.category[currentCategory].item[item].image+"_sm.jpg";
  97.         //aImages.push({label:itemLabel,source:itemImage});
  98.         aImages.push({label:itemLabel});
  99.     }
  100.     var dpImages:DataProvider = new DataProvider(aImages);
  101.     txtFldPassage.dataProvider = dpImages;
  102. }
  103.  
  104. cbStyle.addEventListener(Event.CHANGE, selectCategory);
  105.  
  106. function selectProduct(evt:Event):void 
  107. {
  108.     currentItem = evt.target.selectedIndex;
  109.     var itemLabel:String = productsXML.category[currentCategory].item[currentItem].name;
  110.     var itemDesc:String = productsXML.category[currentCategory].item[currentItem].desc;
  111.     var itemPrice:String = productsXML.category[currentCategory].item[currentItem].price;
  112.     txtFldQuestions.text = "$"+itemPrice;
  113.     txtFldFeedback.text = itemLabel + "\n" + itemDesc;
  114. }
  115. txtFldPassage.addEventListener(Event.CHANGE, selectProduct);
  116.  
Sep 8 '08 #1
0 2372

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

Similar topics

7
by: Rodney King | last post by:
Hi, I have developed an ASP page which dynamically displays a list of checkbox options based on a SQL statement. Here is my code: <div style="OVERFLOW:auto; Height: 150px"> <table> <% dim...
4
by: feanor | last post by:
I need to select children checkboxes when selecting the parent one. This is my function: function SelectChildrens(checkbox_name){ form = document.forms; Sname = checkbox_name.split("-"); for...
0
by: Steven | last post by:
Hi, I'm creating a custom checkbox list control which will take 2 arraylists as input. (One will contain Names and other will contain 0s and 1s. 0 - uncheck 1- check). I'm able to create the...
2
by: Martin | last post by:
Hi, Please can somebody explain how databinding is done on a checkbox list. I have the follwoing code which I would have thought was enough to databind a checkbox, but apparently not. The...
8
by: Alan Silver | last post by:
Hello, I have a repeater that has code like this... <ItemTemplate> <asp:CheckBox ID="chkDelete" Text="" RunAt="server"/> .... other stuff goes here </ItemTemplate> There is a button below...
6
by: Daz | last post by:
Hi everyone. Firstly, I apologise if this i not what you would call a PHP problem. I get quite confused as to what lives in which realm, so if this shouldn't be posted here, please suggest where...
1
by: snsit1 | last post by:
Hello - i am wondering if anyone can help, I am fairly new to javascript / html and am having difficulty getting selected options ticked using check boxes out to a .txt file and have another script...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
3
by: uremog | last post by:
I have a set of of check boxes. onClick, the checkboxes call check_radio and recup_checkbox. the referenced radios function as group selectors. check_radio just unchecks the radios if someone...
2
markrawlingson
by: markrawlingson | last post by:
Hi guys, I have a bunch of drop down lists on a page, with a checkbox beside each one that relates to each one respectively. When a user selects an option from the drop down, the checkbox is...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.