# Passing an external object

**URL:** <https://forum.kirupa.com/t/passing-an-external-object/321114>\
**Category:** flash\
**Created:** [April 11, 2011, 10:13am UTC](https://forum.kirupa.com/t/passing-an-external-object/321114 "2011-04-11T10:13:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![coggia](https://avatars.discourse-cdn.com/v4/letter/c/8c91f0/32.png) [@coggia](https://forum.kirupa.com/u/coggia)\
**Post date:** [April 11, 2011, 10:13am UTC](https://forum.kirupa.com/t/passing-an-external-object/321114/1 "2011-04-11T10:13:57Z")

</div>

Hello,

I got an object into a class (a public one) called “squaddie0”, and when i try to call it back from another class dynamically with :

the main\_class is the passed class, i get the vars like this : main\_class.var1  
var index:int = 0;  
var ob:Object = (getDefinitionByName(main\_class[“squaddie”+index]) as Object;

I get an error as an undefined object…  
Why that ?

thanks again
