Collection ArrayCollection in flex and ArrayList in java




Salvation of this world don't
Here I am with my problem with the hope someone can solve it
I am totally new to flex and I work only for 3 days in flex. and I learned a little more.
I want to get the values of database that is received from java to flex datagrid object by using the data provider.
I did quite well in my opinion. But I could not produce the result in the data grid. Since I am very new. I don't know what is happening.

my code is here, please help me.

My mxml file: Myadmin.mxml

<? XML version = "1.0" encoding = "utf-8"? >
"" < mx:Application xmlns:mx = ' http://www.adobe.com/2006/mxml ' layout = "vertical" >
< mx:RemoteObject id = "ber" destination = "dock" showBusyCursor = "true" fault = "faultHandler (event)" > "
< name mx:method = "getBerth" result = "resultHandler (event)" / >
< / mx:RemoteObject >

< mx:Panel id = 'Top' title = "MaBase" width = "100%" height = "40%" enabled = "true" >
< mx:TextArea id = "sql" width = "100%" height="100%"/ >

< mx:Button label = "Execute" click = "handleSend ()" / >

< / mx:Panel >

< mx:Panel id = "bottomPanel" title = "Results" width = "100%" height = "60%" enabled = "true" >
< mx:DataGrid id = "dg" dataProvider = "{result}" width = "100 percent" height="100%"/ >


< / mx:Panel >
< mx:Label id = "resultLabel" text = "Onumae puriyale ulgathulae" / >

< mx:Script >
<! [CDATA]

Mx.rpc.events import. *;
Import mx.collections. *;
Mx.controls import. *;
Import mx.utils.ObjectUtil;




caching empty ArrayCollection collection so that we don't continue to create
new

private var emptyResults:ArrayCollection = new ArrayCollection();

[Bindable]
public var result: ArrayCollection collection = emptyResults;







private void resultHandler(event:ResultEvent):void
{
Alert.Show ("event.result table of results", ObjectUtil.toString (event.result as ArrayCollection collection));
result = ArrayCollection (event.result);
var myCursor:IViewCursor=result.createCursor();
var oldLength:int = result.length;

Alert.Show (oldLength.ToString ());




}

private void faultHandler(event:FaultEvent):void
{
Alert.Show (event.fault.faultString, "Error");
}

private function handleSend (): void
{


ber.getBerth ();


}




[]] >
< / mx:Script >


< / mx:Application >

My java object: Berth.java


package samples.sqladmin;
import java.sql. *;
Import Java.util;
import java. IO;

public class Berth

{
Public Shared Sub main (String args []) throws exceptions
{
List ArrayList = getBerth();
System.out.println ("the list is =" + list);
}

public static ArrayList getBerth () throws Exception {}
Connection con = null;
Statement st = null;
ResultSet rs = null;
ResultSetMetaData rsmd = null;
List ArrayList = new ArrayList();
HashMap line = null;
try {}
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException nctf) {}
System.out.println (CNFE.getMessage ());
}
try {}
con = DriverManager.getConnection ("jdbc:odbc:Jurong", "","");
St = con.createStatement ();
String sql = "select * berth;
RS = ST. ExecuteQuery (SQL);
rsmd = rs.getMetaData ();
int colCount = rsmd.getColumnCount ();
While (RS. Next {}
line = new HashMap();
for (int i = 1; i < = colCount; i ++) {}
Row.put (rsmd. GetColumnName (i), rs.getString (i));
}
List.Add (Row);
}

}
{} catch (SQLException sqle)
System.out.println ("enna da yogans eeeeee...");
System.out.println (sqle.getMessage ());
}

If (con! = null)
con. Close;
If (st! = null)
St.Close ();
back list;

}

}

my remote-config file is:

< destination id = "dock" >
Properties of <>
samples.sqladmin.Berth < source > < / source >
< / properties >
< / destination >

I got the table in flex collection object, but it gives the values received in java

Please help me.
Thanks in advance
yogans.

Hi my dear friends

I'm sorry to put you in trouble. I got the result. The problem is
not with the code. its with my system. The problem is that I have configured
same name for datesource for system and user DSN DSN name. After that I deleted
a user DSN data source. I got it working.

Thank you very much william, thank you much Nelson for your spontaneous response

Thank you
Yogans

Tags: Adobe LiveCycle

Similar Questions

  • Help needed to convert the ArrayList collection ArrayCollection


    I am converting an ArrayList (Java) to the collection of Flex ArrayCollection.
    Please help me in this, I don't know whether there is a correct approach

    I have a created a class user VO ActionScript Flex with two properties as uname, pass.

    [Bindable]
    var result: ArrayCollection collection

    private void displayDetails(event:ResultEvent):void
    {
    result = event.result as ArrayCollection collection;
    }


    < mx:DataGrid dataProvider = "{result}" >
    < mx:columns >
    < mx:DataGridColumn headerText = "UserName" dataField = "uname" / >
    < mx:DataGridColumn headerText = "Password" dataField = "pass" / >

    < / mx:columns >
    < / mx:DataGrid >

    It's my DAO of Java file:


    ResultSet rs = stmt.executeQuery ("select NAME, PAST by users");
    list = new ArrayList();
    While (RS. Next {}
    User user = new User();
    user.setUname (rs.getString (1));
    user.setPass (rs.getString (2));
    List.Add (User);

    }


    back list;

    With the code below, the DataGrid displays is empty without data, please help me where I am wrong doung

    I have to do something more? The data comes on the lcds Server console.

    Help, please.

    Hi Kiran,

    Try this once...

    private void displayDetails(event:ResultEvent):void
    {
    result = new collection ArrayCollection (event.result as Array);

    }

    Just try to debug by placing the stop point and make sure that you have found event.result as array... If not, then change your code accordingly.

    Thank you

    Jean Claude

  • 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.

  • Problems using collection ArrayCollection as a DataProvider for trees and the menu bar, possibly bug?

    Hi guys,.

    I'm having some troble using a collection ArrayCollection as a DataProvider for a tree and a menu bar...

    I read some Adobe documents on this subject, and I read that two components read the dataProvider in the same way.

    but my current works of DataProvider well on the tree, but not on the MenuBar component...

    My dataProvider is an ArrayCollection collection of a custom class (which extends from ArrayCollection collection), and among its assets is a children's collection: ArrayCollection, so the hierarchy can be read correctly.

    When I use the component of the tree it works, but the menu bar do not display the branches...

    Can someone help me?

    Here's the function that create my dataprovider:


    private function fnFillDP (): void {}
    for (var i: int = 0; admResult.length > i; i ++) {}
    If (.nivel JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]) == 0) {}
    var novoMenu:CL_ArrayMenu = new CL_ArrayMenu();
    novoMenu.idMenu = .idMenu JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenu.titulo = .titulo JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenu.parent = .parent JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenu.nivel = .nivel JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenu.ordem = .ordem JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);

    dataProvider.addItem (novoMenu);
    } ElseIf (.nivel JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]) == 1) {}
    for (var j: int = 0; dataProvider.length > j; j ++) {}
    {If (CL_ArrayMenu(dataProvider[j]).idMenu == {JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]) .parent})}
    var novoMenuChildren:CL_ArrayMenu = new CL_ArrayMenu();
    novoMenuChildren.idMenu = .idMenu JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenuChildren.titulo = .titulo JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenuChildren.parent = .parent JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenuChildren.nivel = .nivel JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    novoMenuChildren.ordem = .ordem JV_MenuAdm (JV_AuxMenuAdm(admResult[i]).menuAdm [0]);
    If (dp.length > 0) {}
    If (CL_ArrayMenu (dp.getItemAt (0)) .parent == novoMenuChildren.parent) {}
    dp.addItem (novoMenuChildren);
    } else {}
    DP = new ArrayCollection();
    dp.addItem (novoMenuChildren);
    }
    } else {}
    dp.addItem (novoMenuChildren);
    }

    CL_ArrayMenu (DataProvider [j]). Children = dp;
    break;
    }
    }
    }
    }
    tree.dataProvider = dataProvider;
    menu.dataProvider = dataProvider;
    }

    Sorry for the bad English...

    Hello

    You can try using xml as the dataprovider of the Menu bar instead of going for the Arraycollection collection.

    Thank you

    Roman

  • 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

  • Error creating collection ArrayCollection getResourceBundle

    Hi I have just the following line of code in a new 0.9.2

    var a : ArrayCollection = new ArrayCollection();
    

    which result in a runtime error.

    TypeError: Error #1006: getResourceBundle is not a function.

    at mx.collections::ListCollectionView$cinit()

    Global $init () [C:\dev\GMC\sdk\frameworks\mx\collections\ListCollectionView.as:73]

    Global $init () [C:\dev\GMC\sdk\frameworks\mx\collections\ArrayCollection.as:59]

    to PlaybookMobileApp() [/ Users/anthonymccormick/Documents/FlashBuilderProjects/PlaybookMobileApp/src/PlaybookMobileApp.as:19]

    Should I not use ArrayCollections? and if not, do I need to use?

    Thanks in advance

    Anthony.

    Hi anthony,.

    from the looks of it the collection ArrayCollection class is available only if you are coding in Flex (MXML). Since you only use ActionScript, you cannot use this class. Now depending on what you want to achieve with your application, there are different equivelents. on the fly, your best bet will be to use the DataProvider class in the catalog of QNX API:

    http://www.BlackBerry.com/developers/docs/airapi/1.0.0/QNX/UI/data/dataProvider.html

    hope that helps. Good luck!

  • 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;
    
  • Problem with allocating memory collection arraycollection by AddItem

    I have a strange problem with the AddItem method.

    I made a new item with this code:

    ------

    for (var u: int = 0; u < 41; u ++) {}
    Page = new PageToSave();
    project.addPage (page as PageToSave);
    }

    -----

    the project is a distance of class projectblueprint:

    package marcoDoItBetter.utils
    {
    Import mx.collections.ArrayCollection;
    public class ProjectBlueprint
    {
    private var _pages:ArrayCollection;

    public void addPage(page:PageToSave):void
    {
    This._pages. AddItem (page);
    }

    }

    }

    ----

    PageToSave is a class that extends the object.

    When we create the element using the addPages (so with in the collection _pages arraycollection's addItem) programmatically, we have this result using the term Inspector in debug mode.

    It is on the output of the debugger:

    pageList = mx.collections.ArrayCollection (@105cf341)
    [inherited] =
    [0] = marcoDoItBetter.utils.PageToSave (@113cb461)
    [1] = marcoDoItBetter.utils.PageToSave (@113cb401)
    [2] = marcoDoItBetter.utils.PageToSave (@113cb3a1)
    [3] = marcoDoItBetter.utils.PageToSave (@113cb341)
    [4] = marcoDoItBetter.utils.PageToSave (@113cb2e1)
    [5] = marcoDoItBetter.utils.PageToSave (@113cb281) < -.
    [6] = marcoDoItBetter.utils.PageToSave (@113cb221)
    [7] = marcoDoItBetter.utils.PageToSave (@113cb1c1)
    [8] = marcoDoItBetter.utils.PageToSave (@113cb161)
    [9] = marcoDoItBetter.utils.PageToSave (@113cb101)
    [10] = marcoDoItBetter.utils.PageToSave (@113cb0a1)
    [11] = marcoDoItBetter.utils.PageToSave (@113cb041)
    [12] = marcoDoItBetter.utils.PageToSave (@1140dfa1)
    [13] = marcoDoItBetter.utils.PageToSave (@1140df41)
    [14] = marcoDoItBetter.utils.PageToSave (@1140dee1)
    [15] = marcoDoItBetter.utils.PageToSave (@1140de81)
    [16] = marcoDoItBetter.utils.PageToSave (@1140de21)
    [17] = marcoDoItBetter.utils.PageToSave (@1140ddc1)
    [18] = marcoDoItBetter.utils.PageToSave (@1140dd61)
    [19] = marcoDoItBetter.utils.PageToSave (@1140dd01)
    [20] = marcoDoItBetter.utils.PageToSave (@1140dca1)
    [21] = marcoDoItBetter.utils.PageToSave (@1140dc41)
    [22] = marcoDoItBetter.utils.PageToSave (@113cb281) < -.
    [23] = marcoDoItBetter.utils.PageToSave (@1140db81)
    [24] = marcoDoItBetter.utils.PageToSave (@1140db21)
    [25] = marcoDoItBetter.utils.PageToSave (@1140dac1)
    [26] = marcoDoItBetter.utils.PageToSave (@1140da61)
    [27] = marcoDoItBetter.utils.PageToSave (@1140da01)
    [28] = marcoDoItBetter.utils.PageToSave (@1140d9a1)
    [29] = marcoDoItBetter.utils.PageToSave (@1140 d 941)
    [30] = marcoDoItBetter.utils.PageToSave (@1140d8e1)
    [31] = marcoDoItBetter.utils.PageToSave (@1140 d 881)
    [32] = marcoDoItBetter.utils.PageToSave (@1140 d 821)
    [33] = marcoDoItBetter.utils.PageToSave (@1140d7c1)
    [34] = marcoDoItBetter.utils.PageToSave (@1140 d 761)
    [35] = marcoDoItBetter.utils.PageToSave (@1140 d 701)
    [36] = marcoDoItBetter.utils.PageToSave (@1140d6a1)
    [37] = marcoDoItBetter.utils.PageToSave (@1140 d 641)
    [38] = marcoDoItBetter.utils.PageToSave (@1140 d 221)
    [39] = marcoDoItBetter.utils.PageToSave (@1140d5e1)
    [40] = marcoDoItBetter.utils.PageToSave (@1140 d 461)
    source = Array (@1140c9a9)

    as you can see the [5] and the [22] PageToSave id internal flex (or instances of the class has the same address listing.

    "I don't know the exact name of it). It happens totally randomly.

    sometimes fine, sometimes there's more than a duplicate with random address referencing the game.

    I don't want duplicated instances, but I want independent authorities.

    I tried to change addItem with

    This._pages.addItemAt (page, 0);

    Same result.

    I also tried pagina = null before the statement new but same result

    ------

    for (var u: int = 0; u < 41; u ++) {}
    Page = new PageToSave();
    project.addPage (page as PageToSave);

    Page = null;
    }

    -----

    is a garbage collector from?

    How can we solve this problem?

    Thank you

    Hello

    From the looks of it, looks like a bug.

    Are you defining filters or performs a sort on the ArrayCollection collection? Or it's just a pure naked collection instance ArrayCollection.

    Have you tried addItemAt() and got the same result?

    Mike

  • 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

    
    
      
        
      
      
      
        
          
          
            
            
            
            
          
          
            
              
                
                  
                    
                      
                        
                          
                        
                      
                    
                  
                
              
              
              
              
            
          
          
        
        
          
          
            
              
              
              
              
            
          
          
        
      
    
    
  • 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

  • Impression of field collection ArrayCollection object

    Hi all

    I can return the collection of items in area code (POJO/value object) server that can be extracted as a collection table-side client in Flex. On the iteration of the table collection, we can get each item as an object. It is now possible to print/get the individual properties on object/POJO without creating/binding with action script class.

    For example a collection of used class has been removed from the side server, and we have in collection ArrayCollection. We can print the Rible properties such as first name, last name etc without creating a corrosponding action script class.

    Thank you

    Hello

    well, sure you can.

    As you mention all the object will be an object with all the properties type. Then simply to know the names of these properties.

    for each (var obj:Object in _arrayCollection)

    {

    trace (obj ["name"]);

    trace (obj ["name"]); and so on

    }

  • Enter the filtered items in collection ArrayCollection after such FilterFunction

    It is an easy one. I have my filtering function, but rather than use main ArrayCollection collection after it has been filtered, I want to retrieve all filtered items and pass them in another collection ArrayCollection.

    private var allScreens:ArrayCollection;

    [Bindable]
    private var filteredScreens:ArrayCollection;

    private void filterFunc(value:Object):Object
    {
    If (Number (value.module_number) == 1)

    {
    Returns true;
    }
    Returns false;
    }


    private void filterSuff(value:Object=null):void
    {
    allScreens.filterFunction = filterFunc;
    allScreens.refresh ();

    for (var i: int = 0; i < allScreens.length; i ++)
    {
    If (allScreens.getItemAt (i) .module_number == 1) {}
    filteredScreens.addItem (allScreens.getItemAt (i) .filename);
    }
    }

    trace (ObjectUtil.toString (filteredScreens));
    }

    Hmm, addAll() is a function for the ArrayCollection with Flex SDK 3.3 collection, but I guess not in some versions.  A loop could perform the same function.

    var point: Object;

    for each (item in the original)

    {

    filtered.addItem (item);

    }

    Let me know if it does the trick.

    Ben Edwards

  • 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;
    }

  • Collection ArrayCollection clone

    [Salvation all THE]

    I decided to create a new topic for a problem in another... never mind: P

    Simple question

    I had a myOriginal (collection ArrayCollection), clone/where you want it and call the new: myCloned (collection ArrayCollection).

    myOriginal cannot be updated any more.

    This is my code so far but it stills updated the original Collection. I prove that by the loop and the trace of the original Collection.


    [Bindable] private var myData:ArrayCollection;
    [Bindable] private var myCloned:ArrayCollection;

    private void resultHandler(event:ResultEvent):void {}
    myData = event.result.db.data; Original data
    cloneOriginal(); Perform cloning
    myData.disableAutoUpdate (); It is wrong... in the 'core' still updates... I think so..
    }


    private function cloneOriginal (): void {}
    var myCloned:ArrayCollection = new ArrayCollection();
    for (var c:int = 0; c < myData.length; c ++) {}
    myCloned.addItem (myData [c]);
    }


    Thanks in advance... ;)
    Base on...

    Thank you for using Clara, after some time, I've done the correction :)

    Final code, thanks to anyone are [[]]:

    "- How do I clone an ArrayCollection collection.

    Import mx.utils.UIDUtil;
    Import mx.collections.ArrayCollection;
    Import mx.rpc.events.ResultEvent;

    [Bindable] public var myOriginal:ArrayCollection;
    [Bindable] public var myCloned:ArrayCollection = new ArrayCollection();

    FLEX THINGS...
    public void objectCopier(toAdd:Object):Object {}
    var addME:Object = clone (n);
    addME.mx_internal_uid = UIDUtil.createUID ();
    return Alain;
    }

    public void clone(source:Object): * {}
    var myBA:ByteArray = new ByteArray();
    myBA.writeObject (source);
    myBA.position = 0;
    Return myBA.readObject ();
    }
    END

    public void resultHandler(event:ResultEvent):void {/ / result of a HTTPService...} For example, of course...
    myOriginal = event.result.db.data;
    myCloned = clone (myOriginal); THE ACTION IS HERE

    hList.dataProvider = myOriginal; Stay forever with these data
    hList2.dataProvider = myCloned; Table working on it
    }

Maybe you are looking for