# Load an array of custom objects from a shared object

**URL:** <https://forum.kirupa.com/t/load-an-array-of-custom-objects-from-a-shared-object/253834>\
**Category:** flash\
**Created:** [March 5, 2008, 5:02pm UTC](https://forum.kirupa.com/t/load-an-array-of-custom-objects-from-a-shared-object/253834 "2008-03-05T17:02:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![contrast](https://avatars.discourse-cdn.com/v4/letter/c/f05b48/32.png) [@contrast](https://forum.kirupa.com/u/contrast)\
**Post date:** [March 5, 2008, 5:02pm UTC](https://forum.kirupa.com/t/load-an-array-of-custom-objects-from-a-shared-object/253834/1 "2008-03-05T17:02:39Z")

</div>

I have an array of Widgets (a class I created) called “widgetArray” that I save into a shared object.

savedGame1.data.widgetArray = widgetArray;

When I go to load this data out and use the widgets I run into problems. The array is stored fine, but each widget is saved as an object. So I can’t simply do:

widetArray = savedGame1.data.widgetArray;

because then if I try to use the widgets:

widgetArray[0].someWidgetFunction();

it does not work because flash thinks they are objects. I have tried typecasting the widgets when I load them, but it only produces a null object.

widgetArray\* = widgetArray\* as Widget;//widgetArray\* becomes null  
tempWidget:Widget = widgetArray\* as Widget;//null as well

How does anyone else deal with this?
