Actionscript :: Memory Difference Between Arraycollection And Dictionary In Flex
Aug 16, 2011To optimize my application dictionary is a better option or arraycollection where both satisfy my needs.
View 1 RepliesTo optimize my application dictionary is a better option or arraycollection where both satisfy my needs.
View 1 RepliesDifference between the Array and ArrayCollection in Flex?
View 2 RepliesI 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 RepliesWhat exactly is the difference between an object and a dictionary in Actionscript?
var obj:Object = new Object();
obj.something = "something";
var dict:Dictionary = new Dictionary();
dict.something = "something";
trace(obj.something, dict.something);
The trace statement seems identical...
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].....
my understanding is that primitive types (uint, string, Number, etc.) of a class do not need to be set to null for garbage collection.
for example, i am not required to write this dispose() method in the following class:
package
{
//Imports
import flash.display.Shape;
[Code]....
if this is true, which i believe it is, what is the difference between objects of primitive types and objects of non primitive types concerning memory allocation?
Is it possible to clear a Flex flash.utils.Dictionary? I have a Dictionary that I want to clear (remove all elements).
View 3 RepliesAs the title suggests, is it possible to use AMF to encode/decode Dictionaries (without subclassing, that is)? For example, here's a test case:
[Code]...
Does Flex Dictionary maintain the order of its elements?
View 2 RepliesI am using Flex dictionary to store ValueObjects with Timestamp as the 'key' for each object.
Given a timestamp, I want to iterate over the dictionary starting from the given timestamp key value.
The Docs discuss the following for dictionary iteration, but this iterates from the first key-value pair.
for (var key:Object in myDictionary)
{
trace(key, myDictionary[key]);
}
I wrote an application in flash AS3, and when I trace from flash the total memory usage of the total application is only about 9MB, But at the same time Task Manager Shows the memory usage as 110MB. Around 100MB difference.Flash Trace Method System.totalMemory difference of the Trace from the Beginning of the application to end of the application.
View 2 RepliesI've noticed that when debugging using the eclipse flash builder plugin, one cannot drill in to the key set / values of a flash.utils.Dictionary in the Variables view. Even after selecting the "Show Logical Structure" button. Does anyone else run into this issue? Is there anyway I could see the see all of the keys / values when debugging (apart from writing a loop to do this or manually testing possible keys in the Expressions view)?
View 1 RepliesThe dictionary use strict equals(===) for key comparison, how to change the comparison, so I can use my standard for comparison, for example, I have a class named Student:
class Student{
var id:int;
var name:String;[code]....
I want Dictionary use id to compare if the two keys are equal, not use strict equal(===) to compare if the key is the same.
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.
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]....
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>();
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.
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 RepliesIs 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 RepliesContext:
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?
is there any way to use ArrayCollection (from mx.collections.*) in Flash CS3/4/5? How?
View 2 RepliesI have an ArrayCollection with data; a trace of random index of this using
[code]...
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 RepliesI 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]....
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];
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 RepliesI 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].....
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.
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?
is it somehow possible to get item's depth in ArrayCollection?
View 3 Replies