Array out of an Object/sharedObject?

I am using a sharedObject in a shopping cart, I can add items to it and even display in a grid but cannot for the life of me get the data back out into variables or an Array. I just keep getting 'undefined'.

CREATION of the sharedObject
var shopCart:Object = SharedObject.getLocal("FanFestCart");
if (shopCart.data.shopList == undefined){
      shopCart.data.shopList = [];
}else{
};

IN THE GRID
cartGrid.dataProvider = shopCart.data.shopList;

ADDING TO IT;
shopCart.data.shopList.push({Name:detailName, UPC:detailUpc, Color:detailColor, Size:detailSize, Price:detailPrice, Weight:detailWeight, Quantity:detailQuan, Total:detailTot, TotWeight:detailTotWeight});
      shopCart.data.flush();

COPYING TO AN ARRAY
????
livewire_cjpAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aneesh ChopraCommented:
hi,

it should be done this way:
----------
//CREATION of the sharedObject
var shopCart:Object = SharedObject.getLocal("FanFestCart");
var my_local_array = [];
if (shopCart.data.shopList != undefined){
   my_local_array=shopCart.data.shopList;
}else{
      
};
//IN THE GRID
//cartGrid.dataProvider = my_local_array;

//ADDING TO IT;


my_local_array.push({Name:"detailName", UPC:detailUpc, Color:detailColor, Size:detailSize, Price:detailPrice, Weight:detailWeight, Quantity:detailQuan, Total:detailTot, TotWeight:detailTotWeight});

shopCart.data.shopList=my_local_array;
shopCart.data.flush();
----------------
livewire_cjpAuthor Commented:
You know, it looked good but...
grid doesn't populate and I'm still where I was.
Aneesh ChopraCommented:
can you please upload your sample FLA to have a closer look.

or mail it ,, my email is in PROFILE..

Rgds
Aneesh
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Aneesh ChopraCommented:
try this:

you have to get the latest data from shareObject before assigning it to data to grid

----------
// just re-intialize the "shopCart" object
var shopCart:Object = SharedObject.getLocal("FanFestCart");
cartGrid.dataProvider = shopCart.data.shopList;;
----------

Rgds
Aneesh
livewire_cjpAuthor Commented:
I appreciate the try but I ended up figuring a way myself.  shopCart.data.shopList[i].["fieldname"]  It is not a perfect way but I can get the data out, and sincer I cannot pass an Array to the ASP page to send the mail it works.  Now if I can just figure out a way to dynamically create and name variables I'd really be set.

var variableName[i]  doen't work
muxxterCommented:
Hi livewire_cjp,

To make dynamically named variables:

this["<nameString>" + i] = <whatever>;
...OR...
set("<nameString>" + i, <whatever>);

<nameString> can be empty (ie. "")

Basically you're just creating a string for the new variable to be called. Help for this is in the "eval()" help file.

Cheers
MuXx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.