# Library item instantiation function

**URL:** <https://forum.kirupa.com/t/library-item-instantiation-function/283327>\
**Category:** Uncategorized\
**Created:** [March 4, 2009, 11:05pm UTC](https://forum.kirupa.com/t/library-item-instantiation-function/283327 "2009-03-04T23:05:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mleep](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@mleep](https://forum.kirupa.com/u/mleep)\
**Post date:** [March 4, 2009, 11:05pm UTC](https://forum.kirupa.com/t/library-item-instantiation-function/283327/1 "2009-03-04T23:05:27Z")

</div>

Basically looking for a way to get the instance created when I use this function I’ve made, it seems to me “libItem” will be a new instance and I would like to re-assign that back to the item passed into the function so I can access the instance later.

Here is the helper function I created to create library on the stage…

```auto
function objectPlacer( libItem, instance:Class ):void 
{
     libItem = new instance( );
     addChild( libItem );
}

```

So here is how I call the function

```auto
// Function( var name, library item class name, pos x, pos y )
objectPlacer( i_ranks, txt_Ranking );

```

My problem is, I try to access “i\_ranks” later with the following code…

```auto
i_ranks.x = 100;

```

and I get the error: TypeError: Error #1010: A term is undefined and has no properties.

“i\_ranks” is defined as a class member.

_Also, if you know - what should types should I be assigning the parameters instance and libItem in the function?_
