Is there a way you can add elements dynamically to an existing array??

hey guys... i need to add elements to an array dynamically... how do i do that?
for example... in one of my functions i do..
     for each(var item:Object in fileList){
          fileListArr.push(item);
and in a later function i need to add one more element to my fileListArr...
so i tried doing
fileListArr[indexNum].push({
     key:videoKey
so i need to have an array which resembles something like this...
Before adding elements...
fileListArr:
     [0]:  name:test1
            Size:12K
            caption:testing caption
            number:1
     [1]:  name:test2
            Size:12K
            caption:testing caption
            number:2
after adding key to array
fileListArr:
     [0]:  name:test1
            Size:12K
            caption:testing caption
            number:1
            key:xyxyyy11y1yy1y1y2y2u33n
     [1]:  name:test2
            Size:12K
            caption:testing caption
            number:2
            key:iiduudjmenri112jj2n4n3m2j1j21
any ideas?

hmm interesting... so i made the changes... i changed the array to arraylist and the code i have is as follows... but i still get an error... the error says ... "ReferenceError: Error #1056: Cannot create property key on flash.net.FileReference."
public var videoReference:VideoHandler;
public var fileRef:FileReferenceList = new FileReferenceList();
[Bindable] public var fileListArr:ArrayList = new ArrayList();
[Bindable] public var fileNames:ArrayCollection = new ArrayCollection();
public function selectionHandler(event:Event):void{
     fileRef.removeEventListener(Event.SELECT, selectionHandler);
     var numSelected:int = event.target.fileList.length;
     var fileList:Array = event.target.fileList;
     for each(var item:Object in fileList){
          fileListArr.addItem(item);
          fileNames.addItem({
               num: fileNames.length + 1,
               name: item.name,
               size: formatFileSize(item.size),
               status: ""
     var newListLength:Number = fileListArr.length;
     if(fileCounter > 0){
          loopList(fileCounter);
     else
          loopList(0);
public function loopList(value:int):void{
     //trace("looplist -->");
     if(value < fileListArr.length){
          _numCurrentUpload = value;
          file = new FileReference();
          file = FileReference(fileListArr.getItemAt(value));
          file.addEventListener(Event.COMPLETE, loadVideo);
          file.addEventListener(ProgressEvent.PROGRESS, fileProgress);
          file.load();
public function setUploadKey(event:ResultEvent):void{
     if(event.result.ThereWasAnError){
          Alert.show(event.result.ErrorMessages[0]);
     }else{
          videoKey = event.result.UploadKey;
          if(fileCounter >= fileListArr.length){
               trace("in if");
               fileCounter = 0;
               uploadLoopList(fileCounter);
          }else{
               trace("in else");
               //fileListArr[fileCounter - 1]['videoKey'] = videoKey;
-----> get an error here --->fileListArr.getItemAt(fileCounter - 1).key = videoKey;
               //fileListArr[fileCounter - 1] = [{key: videoKey}];
               loopList(fileCounter);

Similar Messages

Maybe you are looking for

  • I just downloaded massage therapy notebook, and it will not open on my notebook? help!

    i have a macbook pro and a iphone. i would like to use massage therapy notebook on my mac and i dont know how to open it or install it on my mac.

  • SG300 and RVS4000 DHCP problems

    We recently deployed SG300-28 to replace an old 3Com switch. The setup: RVS400 router and all workstations and server are plugged into the SG300 switch. The problem: Windows 7 workstations are unable to obtain IP addresses from the server which is al

  • Business Objects XI 4.0 Semantic Layer Questions

    Can someone tell me if the new Business Objects XI 4.0 Semantic Layer is an alternative to the use of Universes? I.E.  There will be no need for Crystal Reports 2011 Enterprise, and Xcelcius to use Universes at all to access SAP ERP data as well as S

  • Reg : Output determination by BAPI_PO_CHANGE

    Hi,    I am using BAPI_PO_CHANGE in my user exit and I need the output to be determined and an  IDoc should be created. If I do it through ME22n transaction everything works fine.But through BAPI output is not proposed. Is there anything I am missing

  • Process code for /DSD/HH_CREDITDATA

    Good day gurus, I am trying to load the credit master data for customers using the IDoc /DSD/HH_CREDITDATA but I cannot find the correct process code to assign in WE20 to get my IDocs processed. Could you please advice? Many thanks