Hey guys i am reteriving a value using the getitemAt and inserting it in a loop
Now i want to get that answer and store it in an array .I am using additemAt but it doesnt seem to be working.(probably im missing something :/) The datafield of the array where i want to save is the following
<mx:DataGridColumn dataField="Num_Mach" headerText="Machines"/>
the following is the code
for (var x:int=0; x=4; x++){
Servicetimes=int(ProcessAdder.getItemAt(x).Servic e_Rate)
for (var NoMachines:int = 1; ValueRow >100 ; NoMachines++)
{
PartProduced = Servicetimes*NoMachines
ValueRow = 100*(ArrivalParts/PartProduced)
}
NoMachines= NoMachines-1;
ProcessAdder.addItemAt({Num_Mach:NoMachines});
}
Thanks loads
Are you using an Array or an ArrayCollection?
It would seem that you would want to update the Object and then put it back into the ArrayCollection.
Then when you update the Object with your Boolean value, you can just update the ArrayCollection with myArrayCollection.setItmeAt(myObject, myLoopInt);
Gug88,
Your code does a lot of bad things.
First of all variables and functions are NEVER named with a capital letter at the start - you should always use a lower-case letter at the beginning when naming variables and functions. Things that start with a capital letter are Classes or constants.
You should never rely on the value of a loop variable when the loop has finished.
If you are goint to add an item at a specific place you need to say where that place is.
It's not clear if you are talking about an Array or an ArrayCollection.
You can set an array value just by doing processAdder[someIndex] = {Num_Mach:NoMachines};
For an ArrayCollection it's processAdder..addItemAt({Num_Mach:NoMachines}, someIndex);
The Adobe documentation is excellent - spend some time looking at it to pick up how things work.
Paul
I created a simple datagrid with an array collection. Hopefully you can look at this an get some ideas. I plan on getting this uploaded to my web site and explain it a little further. Maybe even expand it a little further.
You should be able to download this, unzip it and just place it in a website based folder. The view source has been enabled, so that you can look through it.
Simple ArrayCollection Update Example - blog post
The example also
I typed "arraycollection" into google and this was the first link: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/ collections/ArrayCollection.html
This should be useful: http://www.adobe.com/devnet/flex/videotraining.html
Good luck.
Paul
North America
Europe, Middle East and Africa
Asia Pacific