Flex :: ArrayCollection Detecting Duplicates By Property Value?
Nov 19, 2010
I'm curious of the best way to detect that an arraycollection contains duplicate objects as determined by an object's property value. For example, var _myArrayCollection:ArrayCollection = new ArrayCollection([{name: "name1", value: "value1"}, {name: "name2", value: "value2"}, {name: "name1", value: "value3"}]);Notice that this arraycollection has 3 items. 2 of the items have the same value for the name property. I would consider this a duplicate. Any ideas what the body of this method would look like? I have ideas but none of them feel very elegant.
View 3 Replies
Similar Posts:
Jul 13, 2010
I am passing a complex object from my .NET library to my Flex application via WebOrb.In order to automatically translate, I am using the [RemoteClass] meta data tag as follows:[code]This works absolutely fine, until I try to extend the Plan class to contain an array of complex items:[code]but the set function never gets called.What can I do to get the children into my Flex app in this way?
View 1 Replies
Oct 14, 2009
I have some XML structures like this:
var struct:XML = <mh>
<mi id="1" stuff="whatever"/>
[Code]....
I wonder if items can be accessed in a similar way, like this:
var stuff:Object = cmenu['id == 2'].stuff;
View 8 Replies
Nov 12, 2009
I would like to put an eventListener on an ArrayCollection's length proprety, but I don't know how to go about this.
I want to do this because I only want code to execute when a certain number of things are in a certain ArrayCollection. I want Flex to wait to execute this code over the next object until that length property drops back to an acceptable level. I think I should do this with events instead of a while loop that sits there spouting NOOPs forever (which I don't know how to do either).
View 2 Replies
Oct 27, 2009
I'm new to Flex and am using TileList bound to an ArrayCollection. The array collection is empty at load time, and then updates with the results from am HTTPService call. The problem is that the item renderers aren't being rendered as expected, I'm guessing because there was no data when they were first rendered at load time. Here's simplified example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Script>
[code].....
View 2 Replies
Dec 2, 2010
I am making a drag and drop game using AS2 in Flash CS5 where mc items are duplicated and enlarged from a menu and can be placed anywhere on the stage to create a custom robot. Each part (arms, head, feet, etc.) is it's own mc with unique instance names. I have the drag and drop part all figured out, and I even have the duplicateMovieClip part working...
HOWEVER... Whenever I move from the current frame that an object was duplicated in, to another frame and then back, the clips dissapear one by one if you try to create a new one. Each list of menu items are in their own frames (heads, torsos, arms, etc.). As the duplicates are made, they remain on stage no matter what frame you go to and can still be dagged around, which is good, but as I said previously, they dissappear when you create a new duplicate. Not all disappear at once, only older created duplicates disappear as you bring in new duplicates.
[Code]....
View 3 Replies
Jul 13, 2010
I am passing a complex object from my .NET library to my Flex application via WebOrb. In order to automatically translate, I am using the [RemoteClass] meta data tag as follows:
ActionScript Code:
[RemoteClass(alias="test.PlanVO")]
public class Plan
{
[Code].....
but the set function never gets called.
What can I do to get the children into my Flex app in this way?
View 1 Replies
May 23, 2011
I have seen numerous examples on how to remove duplicates in ArrayCollection but I can't seem to transpose this to XMLList. In most ArrayCollection examples, the example compares the key of the array with hasOwnProperty method and return a bool. That's fine, but what would I compare to when using an XMLList? Let's say I have:
[Code]....
View 2 Replies
Sep 11, 2010
I've been trying to remove duplicates from an array for a while, or even preventing them, and I'm having nothing but trouble.There's a lot of code to go through.I'm creating an array with objects inside it like so...
Code:
private function getJsonResult(event:Event):void {
//ta.text+=http.lastResult;
[code].....
View 2 Replies
Oct 7, 2011
I have a advanced datagrid and populating some data by using arraycollection. And i am filtering the arraycollection, the arraycollection index got changed.
Arraycollection:- [0] - name: abc
[1] - name: hello
[2] - name: hello1
[3] - name:hai
after filtering the arraycollection as 'hell' , the array collection is displaying like the below:
Arraycollection:-
[0] - name: hello1
[1] - name: hello
Can i know the reason why the index got changed after filter it?
* no server side code for filtering. it is only flex side filtering.
View 2 Replies
Feb 4, 2011
i have a problem using the itemRenderer functionality. When using an ArrayCollection the visible Data in the DataGrid using the itemRenderer will be rendered just fine. But if i start scrolling the entries are repeating in the cells using the renderer. The cells are not filled with date according to the id. What mistake i'm doing here.
I read a lot of the explainations like:
[URL]
here is the code for the set data function (itemRenderer is extending HBox):
override public function set data(value:Object):void {
_data = value;
if(data!=null)
[code]....
View 1 Replies
Apr 20, 2010
the applicable differences between an ArrayCollection and a Vector in flex? I'm unsure if I should be using one over the other. I saw that Vector is type safe and that makes me feel better, but are there disadvantages?
public var ac:ArrayCollection = new ArrayCollection();
versus
public var vec:Vector.<String> = new Vector.<String>();
View 4 Replies
Jul 26, 2011
Setting the text property of a flex DateField makes the selectedDate property of that DateField go to null.I need to set the text property so that I can use a particular format (DD-MMM-YYYY).
View 2 Replies
Jan 9, 2011
Lately i discovered MATE (for Flex development) and was wondering: how do i bind a property in a view (actually a navigatorcontent component) to another property in a class so that they stay in synchronization (meaning that whenever the property in the class changes the property in the view also changes).
So if we have a view called Target.mxml and a property targertProp how do we bind it to the class called SourceClass with property SourceProp?
View 3 Replies
Jul 24, 2009
In Flex, it's easy to convert the XML to Object and to ArrayCollection by using var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(); decoder.decodeXML( xml );
But is there a good way to convert ArrayCollection to XML.
View 3 Replies
Sep 22, 2009
I currently have an arrayCollection in Flex and I want to sent it to PHP (Zend_AMF). According to the Zend_AMF wiki, sending an arrayCollection over directly will force Zend_AMF to cast the arrayCollection as an object which is no good. I'd rather have an array of my models. I assume the best way would be to convert the arrayCollection to an array in flex and then send it over. Is this true, and if so how would I do that in Flex 3? If you have a better recommendation,
View 1 Replies
Oct 21, 2009
Is there any way in Flex where in we can sort an arraycollection based on strings .I have a dataprovider with strings like "Critical" "High" "Medium" "Low" where in I need to sort it in such a way that I need Critical to be displayed on the top and next High , Medium and Low follows.
View 1 Replies
Mar 12, 2010
Context:
I use an ArrayCollection object as follows:
1) Number of elements is fixed.
2) Elements are inserted at a given position, based on some order.
Can I set the max size of the ArrayCollection? Will fixing the size improve the performance, as elements keep getting inserted into this collection?
View 1 Replies
Dec 2, 2010
is there any way to use ArrayCollection (from mx.collections.*) in Flash CS3/4/5? How?
View 2 Replies
Mar 1, 2011
I have an ArrayCollection with data; a trace of random index of this using
[code]...
View 2 Replies
May 14, 2011
I would like to create a new AC instance with a dynamic variable which is nca1, nca2, etc. Without define using hardcode variable name, it is possible to do that in a loop?
View 1 Replies
Jul 14, 2009
I am creating a RSS Feed application based on a data, and I have the following:
I have an ArrayCollection that is pre-populated with data. I am sorting through the ArrayCollection, get 1 piece of data (condition), and need to connect to an RSS feed which returns me the title, and I set my ArrayCollection in correspondence to condition -> title.
public function updateArrayList(list:ArrayCollection):ArrayCollection {
trace(list);
for(var i:int = 0; i < list.length; i++) {
//Alert.show(list.getItemAt(i).condition);
[Code]....
View 1 Replies
Aug 3, 2009
After applying a numeric sort to my dataprovider(Array Collection), I can not reorder the items via a tilelist. Do I need to remove the sort from the arrayCollection. If so, is it just a case of setting collection.sort = null ?
var sortField:SortField=new SortField();
sortField.name="order";
sortField.numeric=true;
var sort:Sort=new Sort();
sort.fields=[sortField];
View 3 Replies
Aug 6, 2009
I am trying to get the contents of an arraycollection to print out using my debug function (which takes a string). Anyone know how to do this? I would like it would be rather easy but can't seem to find a way...I get the word "Object" printed a lot of the time.
View 2 Replies
Nov 11, 2009
I want to load data from a external XML file, using a HTTPService, and on the ResultEvent of the same HTTPService i want him to populate a ArrayCollection with the data from the XML.
I think a ArrayCollection is the ideal for this XML.
XML
<?xml version="1.0" encoding="utf-8"?>
<PhotoGalleryData>
<Photo>
[Code].....
View 2 Replies
Feb 2, 2010
I have built an image cache which is an ArrayCollection containing images. I have built functionality so that the cache can hold a max of 250 images. However, the images can be of a different size, so it's better to limit the total memory size of all images in the ArrayCollection. How I can get the total memory size of an ArrayCollection without looping through all the items in the ArrayCollection?
View 1 Replies
Feb 5, 2010
I have a main class ClassA that has a bunch of "normal" properties that are simple datatype like ints, strings, etc. It also has one property ("childItems") that is an ArrayCollection of ClassB.I am using an ArrayCollection of ClassA as the source for an hierarchical data provider for an AdvancedDataGrid. I set the childrenField to "childItems".
I want to display some information about the list of ClassB objects in a nested table and pie chart, an AdvancedDataGridItemRendererProvider (columnIndex = 0, columnSpan = 0, depth = 2) and point it to my custom renderer which is an HBox with the table and the pie chart in it.
In order to see what is being set, I override the "set data" function in my custom renderer and what I see is that each instance of ClassB in the ArrayCollection is passed to the renderer separately.
Here is my question: I expected the whole ArrayCollection of ClassB instances to be passed to the custom renderprovider once and not each item in the child list individually. How do I make the ADG understand that the whole property is supposed to be passed as the data to the renderer and not each entry separately? Btw, when I change the data type of "childItems" from ArrayCollection to ArrayList, the whole list gets passed and I can easily do what I want to do. But based on my understanding, ArrayList is not really supposed to be used and ArrayCollection is better or at least more common.
View 1 Replies
Mar 19, 2010
I have an ArrayCollection as mentioned below.
private var initDG:ArrayCollection = new ArrayCollection([
{fact: "Order #2314", appName: "AA"},
{fact: "Order #2315", appName: "BB"}[code].....
I want to populate a ComboBox with UNIQUE VALUES of "appName" field from the ArrayCollection initDG.
<mx:ComboBox id="appCombo" dataProvider="{initDG}" labelField="appName"/>
One method I could think is to loop through the Array objects and for each object check and push unique appName entries into another Array. Is there any better solution available?
View 4 Replies
Mar 21, 2010
is it somehow possible to get item's depth in ArrayCollection?
View 3 Replies
Apr 15, 2010
I have a datagrid that gets its data from a webservice.When data from the webservice is retrived it calls the following function:
private function onListReg():void
{
arrRegOld = WSAutoreg.list.lastResult as ArrayCollection;
arrReg = WSAutoreg.list.lastResult as ArrayCollection;
[code].....
The intent is when I hit a update button, it compares arrRegOld with arrReg and see if any values have changes. The problem is whenever I change values on the Datagrid it changes on both the dataProvider and on both ArrayCollections.What should I do so that the binding applies only to one ArrayCollection?
View 1 Replies