Regarding Flex ArrayCollection

Hi All,
I have a ArrayCollection which gets filled up by an DS fill()
method.
The ArrayCollection holds a single object.
When i bind this ArrayCollection to <mxLDataGrid/> the
results are displayed fine.
But when i try to get the Object by using getItemAt(0), am
getting this exception
RangeError: Index '0' specified is out of bounds.
at mx.collections::ListCollectionView/getItemAt()
at emp/::employeeChange()
at emp/__dgEmployee_change()
at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()
at
mx.controls.listClasses::ListBase/mx.controls.listClasses:ListBase::mouseUpHandler()
at
mx.controls::DataGrid/mx.controls:DataGrid::mouseUpHandler()
Here is the code am trying to get the object..
<mx:DataGrid id="dgEmployee" dataProvider="{employees}"
width="100%" height="100%"
alternatingItemColors="[#e6e6e6]" editable="false"
change="employeeChange()" valueCommit="employeeChange()">
<mx:columns>
<mx:DataGridColumn dataField="companyID"
headerText="Company Id" />
<mx:DataGridColumn dataField="name"
headerText="Name"/>
</mx:columns>
</mx:DataGrid>
private function employeeChange():void
if (dgEmployee.selectedIndex > -1)
if (employee !=
employees.getItemAt(dgEmployee.selectedIndex))
employee = employees.getItemAt(dgEmployee.selectedIndex) as
EmployeeDetails;
dsEmployeeFinancial.fill(employeeFinancials, "by-employee",
employee.id);
var myCursor:IViewCursor =
employeeFinancials.createCursor();
employeeFinancial = employeeFinancials.getItemAt(0) as
EmployeeFinancial;
Alert.show("Employee PF :
"+employeeFinancial.providendFund);
Error Occures in the function employeeChange() when getting
the Object from employeeFinancials.getItemAt(0) ;
But the Follwoing DataGrid is working fine without any
exception
<mx:DataGrid id="dgFinance"
dataProvider="{employeeFinancials}" width="100%" height="100%"
alternatingItemColors="[#e6e6e6]" editable="false">
<mx:columns>
<mx:DataGridColumn dataField="basic" headerText="Basic"
/>
<mx:DataGridColumn dataField="houseRentAllowance"
headerText="House Rent Allowance"/>
</mx:columns>
</mx:dataGrid>

You could try testing to see if your ArrayCollection actually
has any objects in it yet. It also seems like you could use the
selectedItem in your code as below:
private function employeeChange():void
if (dgEmployee.selectedIndex > -1)
if (employee != dgEmployee.selectedItem)
employee = dgEmployee.selectedItem as EmployeeDetails;
dsEmployeeFinancial.fill(employeeFinancials, "by-employee",
employee.id);
var myCursor:IViewCursor = employeeFinancials.createCursor();
if (employeeFinancials.length > 0) {
employeeFinancial = employeeFinancials.getItemAt(0) as
EmployeeFinancial;
Alert.show("Employee PF : "+employeeFinancial.providendFund);
Vygo

Similar Messages

  • From Adobe Workspace+Flex : ArrayCollection to ArrayList

    Hi all
    I have created a flex application which sends an ArrayCollection to LCDS 3.1 installed on JBoss. This ArrayCollection is converted into ArrayList which successfuly is converted into Array by a server java program.
    The Problem:
    I incorporate the flex application into Adobe LC PBM ES 2.5. The first time, I execute the process, the flex application is executed successfuly and the ArrayCollection is converted into ArrayList which is also converted into Array. The second time, I execute the process, an error occurs at the server and the cause is that the java program can not figure the mirror java class on the server. But, if I refresh the Adobe Workspace, we go bakc to sequere one where the flex application is executed successfuly the first time.
    Any idea how to over come this issue?
    Best regards
    Khaled

    Hi all
    I have created a flex application which sends an ArrayCollection to LCDS 3.1 installed on JBoss. This ArrayCollection is converted into ArrayList which successfuly is converted into Array by a server java program.
    The Problem:
    I incorporate the flex application into Adobe LC PBM ES 2.5. The first time, I execute the process, the flex application is executed successfuly and the ArrayCollection is converted into ArrayList which is also converted into Array. The second time, I execute the process, an error occurs at the server and the cause is that the java program can not figure the mirror java class on the server. But, if I refresh the Adobe Workspace, we go bakc to sequere one where the flex application is executed successfuly the first time.
    Any idea how to over come this issue?
    Best regards
    Khaled

  • Regarding Flex 3 and Jboss 4.2

    Hello Frnds,
    i am using flex 3
    I am using JBOSS 4.2 as server and if i start the server in the builder it is running properly .
    If i add any project to that jboss server and restarting the server it is throwing an exception like
    java.lang.NullPointerException  and the serveris not starting.
    Please could any one suggest me how to overcome this exception
    Thanks & Regards
    srujan.

    Are you planning on using Jdk 1.4.2 to run JDeveloper or simply the applications you build?
    In case you want the former, I would recommend against it. There are some differences between whatever version of Java it is that 3.2.3 uses and 1.4.x which make it hard to predict how JDev will react.
    The same actually applies to the applications you develop, but then you are also able to try and work around the issues. This, of course, is not the case for JDev.

  • Regarding flex session

    hi,
    My question is ,using username and password i was logged in.But how i have to set userid into session in flex. i am using backend server PHP.
    please find me the solution to solve the problem.
    Thanks and Regards,
    venkat.R

    Hi a.bhavika,
    There is not specifically any session management in Flex as it runs everything on the client side if at all you want to mainatain you can maintain it on the server side. ...and I think for your case I dont think you need any session managemenet as at the time of login only you can identify which user has logged in to the syetem and based on the user logged in you can load all the previleges of that particular user in the Flex application.
    Check out the links below for your understanding...
    http://www.forta.com/blog/index.cfm/2006/9/24/flex-and-session-state-management
    http://www.assembla.com/wiki/show/romoz/Session_Management_in_Flex
    Thanks,
    Bhasker

  • Regarding - Flex Pagination

    hi,
    In the database, A table consists of more than 200 records.i have to display 10 by 10 records.
    My question is ,In the datagrid First i have to display the first ten records.When a user scrolls the in the datagrid i need to display the another 10 records like ....... until all the records i need to display from the table.
    Please help me to solve the problem.
    Thanks and Regards,
    venkat.R

    I have done Flex Pagination using PHP before. It is not impossible as Flex just displays what data comes back from the webservice you are calling. If you would like to see some examples you can click here:
    https://www.gridsport.net/store/?itemid=Alpinestars&name=Alpinestars
    You will have to keep track of the page number. I have my webservice send back an additional parameter that tells flex how many pages of data it has in order to set the maximum for the numericalStepper in the above example. Aside from that the other suggestions of passing variables to a webservice sound right on the mark. I hope this helps.
    Thanks

  • Flex ArrayCollection to Java HashSet

    Hi,
    I got a problem that I cannot resolve by googleing. I need your     expertise:
    Here s the part of the story:
    1 Bdc have many BdcDetails, so in Flex Bdc.as ==>       public var bdcdetails:ArrayCollection; in Java Bdc.java       ==> private Set<BdcDetails> bdcdetails = new       HashSet<BdcDetails>();
    It works perfectly in Flex which means Flex understand what is     inside a Java HashSet. But when a Bdc is sent to Java. Java don't     understand what is inside ArrayCollection, everything is ASObject.     So ((BdcDetails)bdc.getBdcdetails().toArray()[0]) ==> give       ClassCastException
    Please help! Thanks
    P/S: I am using Blaze DS 4.5.0.0-SNAPSHOT

    Thanks, i ve found the work around.
    I create a setter for Bdc.as
    funtion set bdcDetails in which i loop through the arraycollection, cast
    each item to BdcDetails  then put back to the arraycollection.
    That s it. I dont know it s good or not but it works

  • Flex ArrayCollection changing values

    We are using the following code to create a string that we
    can use as the "data" value in a Flex 2 combobox. The data is
    originally being pulled from our Active Directeory.
    q_GetAllEmployeesMod.data is in the form of a GUID.
    <cfset temp =
    querySetCell(q_getAllEmployeesFinal,"Data",'#binaryEncode(toBinary(toBase64(q_getAllEmplo yeesMod.data)),'hex')#'&':'&'#q_getAllEmployeesMod.mailnickname#')>
    One example of the string that we get is
    35EFBFBD2A4EEFBFBD3A6F47EFBFBDEFBFBDEFBFBDEFBFBD1D67EFBFBD5:bsmith
    The query that we are creating works just fine. However, when
    that query is called through a CFC and passed to flex 2 in a Remote
    Object and create an ArrayCollection we get the following value
    353F2A4E3F3A6F473F3F3F3F1D673F5A:bsmith
    It appears that the connector is converting the first Hex
    number that we are passing as a string into another Hex number. Of
    course then when we attempt to use those values against a db they
    don't match. Has anyone run across this?
    Thanks.
    Mark F.

    Thanks I was in there with little luck. Can you explain this please?
    itemUpdated(item:Object, property:Object = null, oldValue:Object = null, newValue:Object = null):void
    Notifies the view that an item has been updated.

  • Clarification required regarding Flex Server

    hi
    I have been studying about the new flex 2 technology and have
    downloaded the flex builder 2trail. I am able to build flex
    application successfully and also have been able to deploy it on
    Windows Office live . But i am very much confused about Flex Server
    facility. First of all is Flex Server and Flex Data Services the
    same. In the documentation provided in the Adobe website the Flex
    server is said to be used to compile the mxml to appropriate swf,
    but i have not downloaded any Flex server then how am i able to
    compile the mxml to flash application.
    Can some one plz give me a more clear idea about Flex Server
    or give some useful link to read about it.

    Be happy to clear this up:
    Flex 2 SDK (software development kit) is the Flex user
    interface (we call it the 'framework') and the mxmlc and compc
    compilers. This is free. It enables you to use HTTPService and
    WebServices.
    Flex Builder 2 is Eclipse (or a plug-in for Eclipse) and
    includes the Flex 2 SDK. Which means it comes with the compilers.
    Flex Server is part of Flex Data Services. Flex Server
    includes Flex 2 SDK and allows you to deploy MXML and AS source
    files to your web server so that when the main MXML file is
    requested, it will be dynamically compiled into a SWF. We call this
    the 'web tier' compiler.
    Flex Data Services also includes Flex Data Management and
    Messaging.
    In addition to these there is also Flex Charting and the
    ColdFusion 7.0.2 Flex Connectivity Kit.
    HTH
    --peter

  • Regarding $FLEX$.

    Hi can somebody tell me why we use $FLEX$.
    Also please tell me what does this do......
    select to_char(to_date(substr(:$FLEX$.FND_STANDARD_DATE_REQUIRED,1,10),'rrrr/mm/dd'),'DD-MON-RRRR') from dual
    Where FND_STANDARD_DATE_REQUIRED is a value set defined.
    Thanks a lot.
    --kumar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    :$FLEX$. is used to refer to access the value of the value set.
    eg: There are 2 parameters in a concurrent program. And the value of the second depends on the first, 1st is a list of suppliers and the 2nd is the list of invoices and the invoice list should populate dynamically based on the supplier selected
    So, the invoice value set would have a where clause as
    vendor_id = :$FLEX$.vendor_name
    Thanks,
    Angelica.

  • Regarding flex module

    I am working in flex since last 7-8 months.I just want to know the main difference between swf loader and module loader as i was using swfloader previously but found module loader interesting.Plz help with proper explanation..And how i can make my application loosely coupled using this module loader with some basic example.Thanks in advance.

    Is there an InDesign question in there somplace? I suspect you may have posted in the wrong forum.

  • Regarding Flex application in Adobe Air

    I> I developed a flex application using FLEX BUILDER3. My
    main.mxml and background image file was under src directory in flex
    project. There was a folder named history under which
    index.template.html was present. I inserted the javascript code
    inside this html file. I want to convert the same flex application
    to a desktop application. So I created a new project as a desktop
    app and copied the mxml file and background image file under the
    src directoy of the project. I am not able to see a folder named
    history. I dont know where and how to insert the javascript and
    html code for creating desktop air application
    > Also the backgroundimage file is not getting display in
    the window. Not sure why is it so. I had inserted the JPEG

    The ability to package Composite Applications in AIR is currently available
    as a limited release, so if you are interested you will need to contact your
    sales channel for more information.
    The technology includes a library (mosaic-mxml.swc) that contains UI
    Components that allow developers to control the loading and placement of
    Tiles or entire AXML Applications within the AIR application. There are
    samples and documentation available.
    As for mobile, there is work underway to support Mobile AIR applications
    scheduled for an upcoming release.
    Matt

  • Flex arraycollection to Coldfusion

    I have an arraycollection that is populated from a
    webservice. Users can edit all fields, and it is possible that
    every row in the database will need to be modified. I'm trying to
    find the best way to get this data back to coldfusion to modify
    several database rows at once. Is there a way to pass the
    arraycollection back to coldfusion as an object or array and loop
    through it on the server side. Any help (including code samples or
    tutorials) would be greatly appreciated.
    Eric

    Flex ArrayCollection have more columns than CF Arrary,It
    doesn't work.

  • How to convert java map collection to flex arraycollection

    Dear all:
    as title, any sample code?  thank for helping
    java map [{"id":140,"state":"Alabama","obama":6,"mccain":5,"ec":3},
                   {"id":91,"state":"Alaska","obama":4,"mccain":5,"ec":3}

    I think the closes thing to an .exe in Java is developing you program as an application, and packing it into an "executable jar" file.

  • Help required regarding AR module, XML and flex builder3

    I need some help regarding flex project in flex builder3.
    I am working on flash based augemented reality using flex builder3. I want to develop a module for a boutique using which user can try on different dresses. I want to build this  module in such a way that camera gets loaded at one side(left) of the window with a TileList (displaying list of images with their prices) on the right side of the window.
    In order to populate the TileList i'm using HTTPservice to dyanamically load xml (xml->containing dress images along with prices). This part is working fine i.e. when i run this project, xml content gets loaded in TileList.
    My problem is when I copy the swf file of my project along with resource files somewhere else and then launch that swf file, it gives me an alert
    that xml can't be loaded. Secondly augmented reality part(i.e. camera) doesn't load; left part of window remains blank).
    I want someone to help me solve these issues.

    Hi,
    use this FM to update ur shipment
    variables
    DATA: lo_tp_g_tra       TYPE v56e_shipment_activities, "Data to modify
          lo_tp_g_shp       TYPE v56e_shipment,
          lo_tp_g_log       TYPE v56e_logfile, " Errors function
    call the function to modify shipments
    CALL FUNCTION 'SD_SHIPMENT_PROCESS'
      IMPORTING
        e_logfile    = lo_tp_g_log
      CHANGING
        c_activities = lo_tp_g_tra
        c_shipment   = lo_tp_g_shp
      EXCEPTIONS
        error        = 1
        OTHERS       = 2.
    Thanks,
    Sendil.

  • Getting started with Flex ...

    Hi All,
    I've been looking a Flex over the last couple of weeks and have managed to setup a couple of basic projects that can read data from a mySQL database etc...  However when it comes to understanding some of the more advanced frameworks and options to use with Flex it starts to get very overwhelming.
    Does anyone have any pointers/suggestions for good material (online or books etc) to start with Flex.  I come from an Oracle Forms development background and in terms of setting up an application with a connection to a database Oracle Forms seems to a lot simplier than building a Flex database application (although the functionality of Oracle Forms as a lot more limited than Flex/Flash).
    I have taken a look at a the book Enterprise Development with Flex: Best Practices for RIA Developers (Adobe Dev Lib)http://www.amazon.com/Enterprise-Development-Flex-Practices-Developers/dp/059615416X/ref=s r_1_6?s=books&ie=UTF8&qid=1319581262&sr=1-6 by Yakov Fain, Victor Rasputnis and Anatole Tartakovsky (Mar 30, 2010), however the very first code example in the book appears to be dated and I'm having trouble getting it to work and finding the appropriately dated source files for the example project.
    I have also taken a quick look at Adobe Flex 4.5 Fundamentals: Training from the Source by Michael Labriola and Jeff Tapper (Aug 5, 2011) which appears to be a bit more recent, however I am not sure how much is covered regarding database connections to databases like mySQL and Oracle.
    Any suggestions on the best learning materials available would be really helpful.  At the moment it feels like I need to be an expert in Flex, MXML, ActionScript, Java, Spring, Hibernate, AMF, Maven, BlazeDS etc etc just to be able to create a simple database centric application (aarrgghh).
    Ideally I would love to be able to find a recent tutorial that goes through the building a relatively advanced Flex database centric application, that includes information about building a database based login/authentication system (without having to use PHP), and database controlled/stored main menu system and a system for modular sub tabs/screens/programs within a main application.
    Regards,
    Leigh.

    Thanks everyone for the replies.  I guess I'm a bit lazy when it comes to reading up on a technology I am not familiar with :-) .  What makes things worse is the Oracle Forms Builder IDE is very highly coupled to the Oracle database and therefore there is no requirement to know or understand the language or technology under hood (other than PL/SQL), Oracle takes care of that within the IDE and the Forms Java Bean (deployed by default with a middleware installation of Oracle application server).
    @dwaynie Started working through the Flex in a week video training yesterday.  Its really good and probably the best place for me to start as it goes over a lot of the assumed knowledge regarding Flex, MXML and AS (stuff I have probably glossed over up until now)
    @Mansuro noticed that spring has a dedicated page on the Flex/Flash plaform site so I'll probably look into this more down the track.  I guess the thing I am little confused about is that there are many examples online that integrate Spring + Hibernate + Maven + Java etc etc, I guess each framework has different features that the others don't and therefore all can be used at once, or does each one offer a completely different service?  More reading is required here I think.

Maybe you are looking for