String XML collection ArrayCollection, how?

Hi all

I am a beginner in Flex 2 and having trouble filling a PopUpMenuButton.

Data for the menu comes from a Web service as an xml string:
<>Protocol
account <>
< id > 1 < /ID >
< name > first < / name >
< / recording >
account <>
< code > < /ID > 2
< name > second < / name >
< / recording >
...
< / Protocol >

Context menu button is defined as:
< mx:PopUpMenuButton id = "AddMenu' label = 'Add' dataProvider ="{protocolList}"= 'name' showRoot = labelField 'false' itemClick ="runAddMenu (event); "/ >

Result handler is:
[Bindable] private var protocolList: XML;
private void gotIt(e:ResultEvent):void {}
protocolList = new XML (e.result);
}

With this configuration the popup appears like:
Add >
first >
1 >
1
first >
first
second >
2 >
2
second >
second

Repeating values where I'm just a right menu.
I do not use attributes but the node element value of data and that seems to be confusing.

I thought that the difficulty it is to convert the XML data in an ArrayCollection collection, but I can't get this to work.

Documentation and examples, I assumed it would be as simple as changing my result handler in order to:
[Bindable] private var protocolList: ArrayCollection collection;
private void gotIt(e:ResultEvent):void {}
var temp: XML = new XML (e.result);
protocolList = temp. Protocol.record;
}

Problem is that gives me a runtime error: unable to compel XMLList for collection ArrayCollection.

For some reason any 'temp' Gets type XMLList and not XML and I couldn't find a way to do it in XML.

I know that I can browse the xml tree and building the ArrayCollection collection, but it seems exaggerated as Flex should be able to do it for me.

I'm something obvious overseeing here?

TIA
Julio Carneiro

Thank you, Tracy, but I ended up iterating over XML data to generate an array to use in the menu. I tried your suggestions before, but the result has always been a hierarchical menu, where it must be flat. Maybe a problem with the help of the element instead of attribute values.

At the end of the day, it's really simple to do this way, here's my latest code that helps someone else:

[Bindable] private var protocolList: Array;
private void loadProtocolsComplete(e:ResultEvent):void {}
var temp: XML = new XML (e.result);
protocolList = new Array ({name: "Select", id:-1});
for each {(var elem:XML in temp.record)
protocolList.push ({name:elem.name, id:elem.id});})
}
addMenu.dataProvider = protocolList;
}

Tags: Flex

Similar Questions

  • How to build a collection ArrayCollection with distinct values of an XMLListCollection?

    Hello, I'm really bad with what seems like it should be a very simple task. I have a XML of course object which consists of only the names of course. I just want to create a new collection of ArrayCollection which consists of only the names of DISTINCT/UNIQUE course in the XML list to use in a combobox control. I tried all sorts of things but nothing I try seems to work. I have a few listed below MXML.

    Any help would be appreciated! Should be simple im sure, and once I understood that, it will make my app built much easier! The value of myDistinctData is the final ArrayCollection collection. For simplicity, I left my attempts failed the loop foreach. THANKS TO ANYONE WHO CAN OFFER HELP!

    MXML CODE:

    <? XML version = "1.0" encoding = "utf-8"? >
    "" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "horizontal" initialize = "GB (); ">

    < mx:Script >

    <! [CDATA]
    Import mx.collections.ArrayCollection;

    [Bindable]
    public var myDataDistinct:ArrayCollection

    public void go (): void {}

    var myData:XML =

    < course >
    < course cid = "1" >
    < name > course 1 < / name >
    < / course >
    < course cid = "2" >
    < name > course 1 < / name >
    < / course >
    < course cid = "3" >
    < name > course 2 < / name >
    < / course >
    < course cid = "4" >
    < name > course 3 < / name >
    < / course >
    < course cid = "5" >
    < name > course 1 < / name >
    < / course >
    < course cid = "6" >
    < name > course 3 < / name >
    < / course >
    < / course >;

    for each {(thisCourse:XML var in myData)

    -SOME CODE THAT CREATES A TABLE OF DISTINCT VALUES GOING HERE?
    }
    }
    []] >

    < / mx:Script >

    < mx:Label text = "names of separate courses:" / > ""
    < mx:ComboBox dataProvider = labelField "{myDataDistinct}" = "" / >

    < / mx:Application >


    I don't know how to remove duplicates in an ArrayCollection collection or otherwise.
    But since you already have an XML and require only a text node inside.
    I go through the easiest way.

    Please take a look


    http://www.Adobe.com/2006/mxml"layout ="horizontal"initialize ="GB (); » >

    Import mx.collections.ArrayCollection;

    [Bindable]
    public var myDataDistinct:ArrayCollection

    public void go (): void {}

    var myData:XML =

    Course 1


    Course 1


    Course 2


    Course 3


    Course 1


    Course 3

    ;

    you need to do collection here ArrayCollection instance before put something u.
    this.myDataDistinct = new ArrayCollection();

    E4X selection
    var xmlList:XMLList = myData.course.name;

    for each (var xml in xmlList)
    {
    trace (XML); you will see that we have now.
    var str:String = new String (xml);
    var flag: Boolean = true;
    for (var i: Number = 0; i
    {
    If (this.myDataDistinct.getItemAt (i) == STR)
    {
    flag = false;
    break;
    }
    }
    if(flag==true) {This.myDataDistinct.AddItem (STR) ;}
    }
    }
    ]]>



  • Collection ArrayCollection to question of XML.

    Hi all. I'm new here and to the use of FLEX, after being a CF coder since it first came out. Also, please excuse the length of this post, but I can refer in the future. And... Thanks for all the great posts so far this galvanized really me.

    Currently, most of my code is 'test', learn how to make the FLEX to do what I want. I'm working on a project where I need to put the extracted data to an MS SQL Server in an AdvancedDataGrid (ADG). The data are such that there may be many children (and their children, etc.) for a given query. I want to do is return the data a little at a time, so that during the first call, I get all the parents of first level (PKIDs). This could be from 10 to several hundred records.

    This is done by the user by selecting the two comboBoxes, who launches a RemoteObject call, then hands to return a set of data to the function below. The function converts the table into XML so that I can then have a hierarchy in which insert children later. At the present time, to display the arrow itemOpen, I add a child model for each parent record (I'll find a better way later). When the user clicks the arrow itemOpen, I now go and get that child records, using the PKID, who is currently working.

    My problem is that, in a second similar function, when I get the kids and create a mainTreeChildren, I want to put them in XML format (which I do), then insert them into the mainTree XML to the appropriate parent, then open the datagrid to this location. That's where I break. I get a message in the service to make children who:

    1120: access of undefined property mainTree.

    So, even though I created the XML file in the function below, when I try to open it in another function, I get the above error.

    Frankly, I'm just starting trying to figure how I then inserts XML children, but that can come later. I have also included an example of the XML file that is created in this function. Full code available if necessary.

    / * Now allows to get data for the Advanced main adgHierarchies of data grid. */
    [Bindable]
    private var adgResultsArray:ArrayCollection;

    private void getNodesByRelationHandler(adg:ResultEvent):void {}
    var temp: collection ArrayCollection = adg.result as ArrayCollection collection;
    adgResultsArray = new ArrayCollection (temp.toArray ());

    convert to XML format
    var mainTree:XML = new XML ("< NAME of HIERARCHY = '" + dgHierarchies.selectedItem.NAME + "' PKID = '" + dgHierarchies.selectedItem.PKID + "" DESCRIPTION = ' "+ dgHierarchies.selectedItem.DESCRIPTION +"' > < / HIERARCHY > "");

    for (var i: int = 0; i < adgResultsArray.length; i ++)
    {
    var newnode:XML = new XML();
    newNode =

    < NAME of node = {adgResultsArray .NAME}
    PKID = {adgResultsArray
    .} PKID}
    DESCRIPTION = {adgResultsArray, . DESCRIPTION}
    RANGEID = {adgResultsArray
    .} RANGEID}
    TYPE = {adgResultsArray, . TYPE}
    RELATIONID = {adgResultsArray
    .} RELATIONID}
    MASS = WEIGHT "100" = '150' LENGTH '40' = >

    < Node NAME = '1 - TestMakeChildPlaceHolder' PKID = '0 '.
    DESCRIPTION = "This causes the arrow to the point of opening to show. > < / node >

    < / node >;

    mainTree = mainTree.appendChild (newnode);

    }

    adgHierarchy.dataProvider = new (mainTree) HierarchicalData;
    rawXML.text = mainTree.toXMLString (); See the XML in a textbox control
    adgHierarchy.validateNow ();
    callLater (expandFirstNode);

    / * called by callLater to make sure that the tree is ready to be called TI expandItem * /.
    function expandFirstNode (): void
    {
    adgHierarchy.expandItem (mainTree, true); Expand the node
    }
    }

    XML example

    < NAME of HIERARCHY = "Hierarchy of Gary tests" PKID = "2684" DESCRIPTION = "this is a list of the something lander mission" >
    < NAME of node = "Essence-3.5 in" PKID = "2690" DESCRIPTION = "" "2690" TYPE = RANGEID = '0' RELATIONID = '601' MASS = '100' WEIGHT '150' LENGTH = "40" = > "
    < Node NAME = '1 - TestMakeChildPlaceHolder' PKID = "0" DESCRIPTION = "This causes the arrow to the point of opening to show. / >
    < / node >
    < node NAME = "Speedometer and odometer" PKID = "2708" DESCRIPTION = "" RANGEID = "2708' TYPE = '0' RELATIONID ="601"= MASS WEIGHT"100"= '150' LENGTH '40' = >"
    < Node NAME = '1 - TestMakeChildPlaceHolder' PKID = "0" DESCRIPTION = "This causes the arrow to the point of opening to show. / >
    < / node >
    < / HIERARCHY >

    Gary

    Okay, I understand it. Ridicule me. I had to do the mainTree XML that may be related. So, it looks like this:

    (first piece of code, then)

    [Bindable]
    public var mainTree:XML;

    private function initMakeXML (): void {}
    lets do some parent XML
    mainTree = new XML ("");

    (the rest of the code)

  • HTTPService XML for ArrayCollection collection

    I'm sure it's due to my lack of experience, but if someone could help me I would be grateful real. I have the following code works when my search returns several results, but it breaks when here is one. For the difficulty I have tried the recommended function toArray but now the arraycollection collection is full of objects and get the error to go. Can someone help me on how I need to retrieve the records from the arraycollection of objects collection?

    Search returns this XML with product repeated for each result:
    < Products >
    < product id = "12345678" >
    < product_title > Widget A < / product_title >
    < description > This is my widget description < / description >
    < image title = "image title" >
    < thumbnail > http://xx.yy.zz < /thumbnail >
    < Host >/< main > http://xx.yy.zz
    < / image >
    < / product >
    < product id = "234567" >
    ...
    < / product >
    < / product >

    The following code works when more than one returned result:
    private void searchHandler(event:ResultEvent):void {}
    styles = new ArrayCollection();
    try {}
    styles = event.result.products.product;
    selectedProduct = 0;
    }
    {} catch (error)
    Alert.Show ("search didn't give any results. \n try a search term more simple. "," Oops "(, mx.controls.Alert.OK);"
    }
    }

    Output:
    < mx:Repeater id = "styleRepeater" dataProvider = "{styles}" >
    < mx:VBox width = "100%" height = "100%" horizontalAlign = "center" textAlign = "center" verticalScrollPolicy = "off" horizontalScrollPolicy = "off" >
    < mx:Image id = "peak".
    source = "{styleRepeater.CurrentItem.image.Thumbnail}" "
    scaleContent = 'true '.
    autoLoad = 'true '.
    Width = "100".
    Height = "100" / >
    < mx:LinkButton
    ID = 'prodName '.
    label = "{styleRepeater.CurrentItem.product_title}" "
    Click = "editProduct (Event.Target.getRepeaterItem ())" "
    / >
    < / mx:VBox >
    < / mx:Repeater >

    To try to make this work, I changed the research manager at the following and even left.
    private void searchHandler(event:ResultEvent):void {}
    try {}
    styles = new ArrayCollection (ArrayUtil.toArray (event.result.products.product));
    trace (styles);
    selectedProduct = 0;
    }
    {} catch (error)
    Alert.Show ("search didn't give any results. \n try a search term more simple. "," Oops "(, mx.controls.Alert.OK);"
    }
    }

    The error that I get through the debugger is:
    WARNING: unable to bind to property 'product_title' class 'mx.collections::ArrayCollection '.

    When I look at track of the styles collection his watch a collection of objects, so I guess I must change my output in some way to account for this, but I'm stumped.

    Any ideas?

    Thank you

    Adam

    See if this post will help you

    http://www.Adobe.com/cfusion/webforums/Forum/MessageView.cfm?forumid=60&CATID=585&ThreadId = 1319898 & highlight_key = y & keyword1 = result

  • How to copy an arraycollection variable collection to another collection arraycollection variable but any change in a var

    Hi all

    I want to create a copy of the collection arraycollection from a table of existing collection variable.

    but when I change the collection newly created arraycollection variable that is showing the other oldest.

    How can I protect the changes the new is does not reflect the older one.

    I use the code below

    var aa:ArrayCollection = new ArrayCollection();

    var aa1:ArrayCollection = new ArrayCollection (aa.source.concat ());

    Thanks in advance;

    Hi Niranjan,

    You can make use of ObjectUtill class to clone, or make a copy of a collection arraycollection.

    In the forum, he is also already talked several times...

    var aa:ArrayCollection = new ArrayCollection();

    var aa1:ArrayCollection = ObjectUtil.copy (aa) like collection ArrayCollection;

    If this post answers your question or assistance, please mark it as such.

    Thank you

    Jean Claude Chari

  • How to browse the collection ArrayCollection?

    I have two datagrids and you want to move items on datagrip and fill the other.  Here is a screenshot of a Visual screen.

    Picture 1.png

    In the screenshot on I can add some names/sex to the datagrid on the left using the text input and the Add button.  I can select the checkboxes for each name of ros as well. I want to do is move the check names in the datagrid control on the left for the datagrid on the right.  4 max.  But if I chose only 2 name, both names would be added to the 1 Racer and Racer 2. Runner 3 and 4 of the race would be left blank.  If I check the new names and submitted it would be in a new line on the left data grid.

    What I can understand is to scroll the datagrid control left and find only the lines of control.  To the right of the datagrid can be quite easily as soon as I figure out how to identify what is checked and what is not checked.

    This is the datagrid on the right.

    "" " < mx:DataGrid x ="10"y ="76"height ="337"id ="list"editable ="false"dataProvider =" rosterArray{}">

    < mx:columns >

    < mx:DataGridColumn headerText = "" width ="30">

    < mx:itemRenderer >

    < mx:Component >

    < mx:CheckBox / >

    < / mx:Component >

    < / mx:itemRenderer >

    < / mx:DataGridColumn >

    "" < mx:DataGridColumn headerText = "name" dataField ="name" width = "200" "editable ="false" / >

    "" < mx:DataGridColumn headerText = "sex" dataField ="sex" width = "40" "editable ="false" / >

    "" < mx:DataGridColumn headerText = "time" dataField ="time" width = "45" editable ="false" / >

    < / mx:columns >

    < / mx:DataGrid >

    The function add to my rosterArray (left datagrid) is below.

    private function rosterAdd():void

    {

    rosterArray.addItem({name:addName.text,sex:sexGroup.selectedValue.toString()});)

    addName.text = ""; empty text entry field.

    }

    I guess I have to scroll datagrid and not the rosterArray because I don't have a place for the checkmarks in the rosterArray.

    Any help idetifying which lines are checked in the left data grid would be much appreciated.

    Thank you.

    This code is not production level, but it should answer your question.

    If this post answers your question or assistance, please mark it as such.

    Greg Lafrance - Flex 2 and 3 certified ACE

    www.ChikaraDev.com

    Flex / development, training, AIR and Support Services

    
    
      
        
      
      
      
        
          
          
            
            
            
            
          
          
            
              
                
                  
                    
                      
                        
                          
                        
                      
                    
                  
                
              
              
              
              
            
          
          
        
        
          
          
            
              
              
              
              
            
          
          
        
      
    
    
  • How to access the Flex collection ArrayCollection in Action Script components?

    I have this code-

    < mx:Label text = "Style" / >
    < mx:ComboBox id = "cboStyle" initialize = "{changeSkin('skins/Plain.swf') ;} "change ="{changeSkin (cboStyle.selectedItem.data) ;} ">
    < mx:ArrayCollection >
    < mx:Object label = "Plain" data="skins/Plain.swf"/ >
    < mx:Object label = "BlueTan" data="skins/BlueTan.swf"/ >
    < mx:Object label = "Brauwny" data="skins/Brauwny.swf"/ >
    < mx:Object label = "Darknite" data="skins/Darknite.swf"/ >
    < mx:Object label = "iCandy" data="skins/iCandy.swf"/ >
    < mx:Object label = "Minty" data="skins/Minty.swf"/ >
    < mx:Object label = "SimplicityGray" data="skins/SimplicityGray.swf"/ >
    < mx:Object label = "SummerSky" data="skins/SummerSky.swf"/ >
    < / mx:ArrayCollection >
    < / mx:ComboBox >

    I would like to do instead of initialize = "{changeSkin('skins/Plain.swf') ;} "East of refers to an item in the collection ArrayCollection.  How can I do this?  I'm relatively new to Flex.  I guess that there is a way to access the ArrayCollection collection and then access the individual table entry.

    Thank you

    Aaron

    Initialize = "{cboStyle.DataProvider.getItemAt (0) .data ;}}" »

    If this post has answered your question or helped, please mark it as such.

  • Help!  How to upgrade two dimension collection ArrayCollection?

    Hello

    I'm having a problem of understanding of documentation on populating a DataGrid of two dimension collection ArrayCollection. My situation is that I have a DataGrid with a bunch of information, currently stored in a two-dimensional array (digital in the first dimension and by field name in the second dimension). I also have a bunch of data streaming from an XMLSocket, which, when it happens, is analyzed, resulting in one of the fields of the table in need of update. I can do very well with the table directly, but I can't try to understand how use the ArrayCollection collection features to cross this two-dimensional structure - setItemAt() does not seem suited for this purpose? I need to trigger the effects on the relevant cell that has been updated, when I round coding, so I will try to use some structure that handles update events and others for me automatically, such as the ArrayCollection collection.

    I do not know is still the best technique to use, and the intermediate level (the ArrayCollection collection and others) could be changed completely, so if you can suggest (and illustrate, if she is as confused as this!) a better method, I would be grateful.

    Thank you

    David

    Ah.

    You must look for the item in the collection ArrayCollection. This is usually done with a loop in the collection. When you have found the item you would:

    Item.Quantity = new quantity;
    dp.itemUpdated (item);

    You must call the method of collection itemUpdated to make the signal Collection all interested parties (for example, the DataGrid bound to her) she's changed.

    A Collection can also views and ViewCursors that might be useful to have a lot of data.

  • The collection ArrayCollection binding

    I have an ArrayCollection collection I am binding to a DataGrid control and everything seems to work except for a column that is an object in the collection ArrayCollection. Basically, it looks like this in XML

    < foo >
    < CAT / >
    < dog / >
    < fruit >
    < apple / >
    < orange / >
    < / product >
    < / foo >
    < foo >
    < CAT / >
    < dog / >
    < fruit >
    < apple / >
    < orange / >
    < / product >
    < / foo >

    I can access the animals in the DataGrid, but I can't understand how to access the fruits. I tried this in the data area DataGridColumn: dataField = "fruit.apple" but that did not work. How do you access the top node children in the DataGrid?

    I think you have to use a labelFunction:

    public void getFruits(item:Object,_column:DataGridColumn):String
    {
    Where item contains the DataGrid item object,
    }

    I don't know what are you trying to display in this column, but as you can see in the getFrutis function you can access to your article (in this case foo), then part of there and show the value you want. Don't forget the function signature must be like this and you should return a string

  • collection ArrayCollection collection arraycollection assigned values from the original setting?

    Hi... I am pretty stumped on this one. Here's the situation... on my main flex app I define an arraycollection collection:

    public var fiscalYrsArray:ArrayCollection;

    The collection is filled with the results of a query to a CFC

    protected function fiscalYrs_resultHandler(event:ResultEvent):void {}

    for (var x: int = 0; x < event.result.length; x ++) {}

    If (event.result [x]. DATA == passData.filterFiscalYrs) {}

    Event.Result [x]. Assigned = true;

    }

    }

    fiscalYrsArray = event.result as ArrayCollection collection;

    }

    I have a main application with drop-down menus window (I use a multi-case combobox). I use this window as a filter window, where users can choose what they want filtered.

    on this component, I use a temporary arraycollection collection (b/c I don't want to change the assignments of the arraycollection the temp collection is based off of) which will be a copy of the fiscalYrsArray of the parentApplication collection:

    " < = xmlns:fx s:TitleWindow ' http://ns.Adobe.com/MXML/2009 'close = "PopUpManager.removePopUp (this)'

    xmlns:s = "library://ns.adobe.com/flex/spark" title = "filter data" creationComplete = "initComp (); »

    xmlns:MX = "library://ns.adobe.com/flex/mx" width = "400" height = "300".

    xmlns:multiPickBox = "Components.multiPickBox. *" >

    < fx:Declarations >

    <! - Place non-visual elements (e.g., services, items of value) here - >

    < / fx:Declarations >

    < fx:Script >

    <! [CDATA]

    Import mx.collections.ArrayCollection;

    Import mx.controls.Alert;

    Import mx.managers.PopUpManager;

    private var tempfilterFiscalYrs:String

    [Bindable] private var fiscalYrDP:ArrayCollection = new ArrayCollection collection;

    private function initComp (): void {}

    fiscalYrDP = parentApplication.fiscalYrsArray;

    tempfilterFiscalYrs = parentApplication.passData.filterFiscalYrs;

    }

    protected function msc_addItemHandler(event:Event,filterVal:String,comboId:String):void

    {

    Alert.Show ("get here '");

    This [filterVal] = ";

    {for each (var point: Object in {this [comboId] .selectedItems)}

    This element of += [filterVal] ['DATA'] + ",";

    }

    filterChange = true;

    idText.text = str;

    }

    I am lie the collection arraycollection filterYrDP to a custom choice multi combobox:

    < multiPickBox:CheckCombo id = "fiscalYearF" width = "162" dataProvider = "{fiscalYrDP}".

    addItem = "msc_addItemHandler (event, 'tempfilterFiscalYrs', 'fiscalYearF')" "

    allIndex = '0' x = "77" y = "17" labelField = "DATA" / >

    However, I find that when an element is activated the assigned = true value is actually applied to the fiscalYrsArray of my parentApplication origin. I just want the assigned = true to apply to the fiscalYrDP collection arraycollection (one that is based on the fiscalYrsArray of parentApplication). How could it be written back and changing the properties of a fi main is just a temporary copy?

    By assigning the table using "=" you are just assigning the same table - in the same memory location.

    If you want to keep a separate table, you use the function ObjectUtil.copy

    import mx.utils.ObjectUtil;
    
    arrNewData  = new ArrayCollection();
    arrOldData  = ObjectUtil.copy(arrNewData) as ArrayCollection;
    
  • GetItemAt collection ArrayCollection

    I want to return the index of an item in a collection of ArrayCollection for setting the selected index of a drop-down list box

    [Bindable] public var time: collection ArrayCollection = new ArrayCollection () collection
    ([{label: "01:00", data: "01:00:00"}, {label: '01:15 ', data: "01:15:00"}, {label: "01:30", data: "" 01:30:00 ""}]);

    The following does not work.

    var point: Object = new Object();
    Item = {data: "01:15:00"};
    This. RepairBySelected = times.getItemIndex (item);

    A string value of "01:15:00".

    How can I return a value of 1 at the time collection (the this value index) ArrayCollection?

    Thank you

    Dan

    Daniel Pride wrote:

    Give the ArrayCollection collection

    [Bindable] public var time: collection ArrayCollection = new ArrayCollection () collection
    ([{label: "01:00", data: "01:00:00"}, {label: '01:15 ', data: "01:15:00"}, {label: "01:30", data: "" 01:30:00 ""}]);

    Give me a use of GetitemIndex which returns the index of the element in the second list. (1)

    Thank you

    Dan

    Yes, Mr President.

    public var _entry:Object = {label: "01:15", data: "01:15:00"};

    public var _entry2:Object = {label: "01:15", data: "01:15:00"};

    [Bindable] public var time: ArrayCollection collection = new collection ArrayCollection ([{label: "01:00", data: "01:00:00"}, _entry, {label: "01:30", data: "01:30:00"}]);

    trace ("" + Times.GetItemIndex (_entry) +', '+ times.getItemIndex (_entry2));

  • Collection ArrayCollection - summing values

    Hello

    In my application an ArrayCollection collection returns values such as '1', '2', '3' and so on. Now, I would like to sum 10 each so that the end result would be '10', '20', '30 '.

    How can I do that. I tried to find a way to convert them to numbers, but I don't know if this "possible.

    Thank you

    Manolo

    That answers your question:

    
    
      
        
      
      
    
    

    If this post answers your question or assistance, please mark it as such.

    Greg Lafrance - Flex 2 and 3 certified ACE

    www.ChikaraDev.com

    Flex / development, training, AIR and Support Services

  • Display collection ArrayCollection in a list and the ArrayCollection with Drag and Drop collection reorgnize

    I have an ArrayCollection collection created like this

    qaAC = new ArrayCollection();

    for (var i: int = 0; i < 10; ++ i) {}
    var o: Object = {question: ' what is "+ i +"? ", answer:" it's "+ i"};
    qaAC.addItem (o);
    }

    The ArrayCollection collection is an array of object that has properties "question" and "answer to" custimized.

    I want to put 'issues' in the ArrayCollection collection in a list. 'qaAC.question' does not return an array of questions for me.

    I have to extract the ArrayCollection collection to form a new String table, and use the new array as the dataProvider of the list of questions.

    Is there a way better and clean?

    My goal is to use a list to reorgnize an ArrayCollection collection that contains complex objects (not simple string) with Drag & Drop. Is this possible?

    Any suggestions?

    I put two lists in my example to show how the ArrayCollection collection could be displayed in two different ways. You don't have to have two lists if you do not need them.

    When you change the order of the list made with drag and drop, you change the order of the collection ArrayCollection qaAC, so all the controls that display the qaAC will also be updated to reflect the new order. You can test this in the example I posted earlier. Change the order in the list of question and you will see the order change also in the list of responses. This is because they are both bound to the same collection of ArrayCollection. If you want to behave independently, you need two separate ArrayCollections.

    Chris

  • Problems on collection ArrayCollection and DataGrid

    Hi people!
    I have a problem of ugly...
    in the my application, I have a datagrid named DG and its dataprovider is bound as an ArrayCollection called AC collection.
    A result of the query contains the AC...

    Ok.. So far so good...

    the problem just when I try to select an object in AC by name...
    AC has done like this:
    0 objecthjh324jghf7
    1 objectd5674567
    2 objectAaagohrtt
    3 object4534c45jg

    so I can choose an object by its index (0,1,2,3... ecc)
    but not by name (objectxxxxxx)

    I might want the names of the objects are the name of the column (such as ID, NAME, NATION, phone ecc)

    is this possible?
    now, if I want the object ID in KT (i.e. the ID column in my datagrid DG), I have to check with a loop from 0 to col_number to find some AC (loop_value) USER.USER

    EDIT
    example:
    If my first column of the DG's 'id', I want to use something like "myDataGrid.columns ('id')", now I have to use this "myDataGrid.columns (0)»
    EDIT
    Help me please! : D :D

    PS: Sorry for my bad English... ^ _ ^

    "Amy Blankenship" wrote
    in the message news:[email protected]...
    >
    > "123qweads" wrote in message
    > news:[email protected]...
    > okay...
    > maybe I made a few mistakes in my last posts.
    > I'll try to explain better my problem...
    >>
    > my problem is to give a name to myDG.columns
    > (before I talk about DATAGRID...) Sorry! I'm guilty... but the problem
    > is
    (> the same)
    >>
    > myDG.colums is a TABLE and I can get you an object index for example
    > myDG.colums (1) .dataFiled or myDG.colums (2) .visible ecc...
    > If I can give a name for the elements of each array, I could take an object by
    > its
    > name for example myDG.colums (ID) .dataFiled or myDG.colums (PRICE) .visible
    > ecc...
    >>
    > Today I discovered how give an object name in the ARRAYCOLLECTION collection... in
    > This
    > way
    > var o: Object = new Object();
    > o [namecol1] = myObject1;
    > o [namecol2] = myObject2;
    > myAC.addItem (o);
    >>
    > works very well and myAC I find namecol1, namecol2, namecol3 instead
    (0), (1), (2) but when I convert collection ArrayCollection in table online
    >>
    >>
    >>
    > I lost all the name of the object... and remains only the information from the object (i.e. the)
    > column
    (> information as dataField, visible, headerText, etc.)
    >>
    > WHY DO I WANT TO DO?
    > I want to write a function that hide certain columns...
    > now, my function is O (n * m), where n< m="" but="" if="" i="" can="" resolve="">
    > problem
    > my function become o (n)
    > and it's a good thing
    >>
    >>
    >>
    >>
    > BAD! (now)
    > public void HideColums(col:Array,_myDataGrid:DataGrid):void {}
    > for (var x: int = 0; x)< col.length;="">
    > for (var i: int = 0; i< mydatagrid.columncount;="">
    > If (myDataGrid.columns .dataField ==
    (> col [x]) myDataGrid.columns
    .visible = false;
    >> }
    >>
    >>
    > GOOD (after your explanation)
    > public void HideColums(col:Array,_myDataGrid:DataGrid):void {}
    > for (var x: int = 0; x)< col.length;="">
    > myDataGrid.columns [col [c] m:System.NET.SocketAddress.ToString ()] .visible = false;
    >> }

    try (somewhere in your result handler that takes care of your objects):

    var sampleObj:Object = myQuery [0];
    columnNames = []; should be set on a global scale
    for {(prop: String en sampleObj)}
    columnNames.push (prop);
    }

    now:

    public void hideColumns(columnsToHide:Array,_myDataGrid:DataGrid):void {}
    for (var x = 0; x)< columnstohide.length;="">
    myDataGrid.columns [columnNames.indexOf (columnsToHide [x])] .visible = false;
    }
    }

    Note This is not tested, but it's the first thing I would try

  • return index collection ArrayCollection-1 after updating in datagrid

    When I called data.refresh ();  arraycollection.getItemIndex (obj1) returns-1

    is anyway to make it work properly or work around?

    <? XML version = "1.0" encoding = "utf-8"? >

    "" < s:Application xmlns:fx = "http://ns.adobe.com/mxml/2009"

    "xmlns: s="library://ns.adobe.com/flex/spark"preinitialize ="application1_preinitializeHandler (event) ".

    xmlns:MX ="library://ns.adobe.com/flex/mx"minWidth = "955" = "600" xmlns:local = minHeight"*" > "

    < fx:Script >

    <! [CDATA]

    Import mx.collections.ArrayCollection;

    Import mx.collections.Sort;

    Import mx.events.FlexEvent;

    private var data: ArrayCollection collection;

    private var obj1:Object;

    protected function application1_preinitializeHandler(event:FlexEvent):void

    {

    obj1 = {'name': '1'}

    data = new ArrayCollection();

    data.addItem (obj1);

    data.addItem({"name":"2"});)

    trace (Data.GetItemIndex (obj1)); 0

    var sort: sort = new Sort();

    sort.compareFunction = nameSort;

    Data.sort = sort;

    data .filterFunction = null;

    Data.Refresh ();

    -1 trace (Data.GetItemIndex (obj1))

    }

    private void aa (): void {}

    }

    private void nameSort(m1:Object,_m2:Object,arr:Array=null):int {}

    Returns - 1;

    }

    []] >

    < / fx:Script >

    < fx:Declarations >

    < / fx:Declarations >

    < / s:Application >

    A comparison function sorts must return 1, 0 or - 1 on a consistent basis.  He

    cannot simply return-1.

Maybe you are looking for

  • Add Google mail as type "other".

    I run an iPhone with OS 9.3.3 6. My ISP has recently moved our domain to GMail accounts. I can set up Mail (the Apple Mail application) to use GMail, but who let me use one of my alias address "from". Suggestions on the web are (were) to configure th

  • I'm trying to restore photos and videos to a CD + RW.

    When I insert the disk and the options to choose to import Live Photo Gallery images.  I t shows 820 new files and when I click on 'Import' nothing happens.  I tried clicking on 'Show files' but it only allows me to copy a file then I get "not respon

  • Sound does not work after the installation of beats audio

    Laptop: HP DV6-7001TU OS: Windows 7 Home Premium (the laptop came with HomeBasic, I got a copy of used HomePremium). I came across this problem recently which was not there before, I bought the computer as soon as I bought almost 5 months ago, I did

  • Free devices in the NAC 4.1

    Hello friends, I m the virtual gateway layer2 mode configuration, I m bit confused regarding what would be the free features of layer2 virtual gateway mode. whenever any device in the vlan for authentication, it will pass through NAC server but if I

  • Home Premium slow close.

    My Windows 7 Home Premium takes anywhere from 30 to 90 seconds to stop. After the installation of the first, my system would be closed in 5-10 seconds. However, over the last week or two, he continued. Remedies?