# Custom base class, same instance name

**URL:** <https://forum.kirupa.com/t/custom-base-class-same-instance-name/293351>\
**Category:** Uncategorized\
**Created:** [July 27, 2009, 7:33pm UTC](https://forum.kirupa.com/t/custom-base-class-same-instance-name/293351 "2009-07-27T19:33:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thisfix](https://avatars.discourse-cdn.com/v4/letter/t/ccd318/32.png) [@thisfix](https://forum.kirupa.com/u/thisfix)\
**Post date:** [July 27, 2009, 7:33pm UTC](https://forum.kirupa.com/t/custom-base-class-same-instance-name/293351/1 "2009-07-27T19:33:16Z")

</div>

I have run into an AS3 problem that I could not find a solution to :

**situation** :  
two symbols in the library (lib1, lib2) with the same custom base class (LibBase) linked to each:

two movieclips (mc1 & mc2) on the stage each with an instance of its respective library symbols (lib1, lib2) inside of them

**problem** :  
My problem occurs when I use the same instance name for each nested ‘lib’ item i.e.

myMc1.myLib – (lib1)  
myMc2.myLib – (lib2)

throws this compile warning:  
_Warning: All instances named ‘myLib’ will be automatically declared as lib2 in symbols that use myLib as their base class.  
In symbols that are linked to user-defined base classes, instances with the same name must be of the same type._

and throws a runtime error:\*  
TypeError: Error #1034: Type Coercion failed: cannot convert lib1@1f026bc9 to lib2.

- 

I found a solution to the error that suggests I uncheck ‘Automatically declare state instances’ in the advanced actionscript 3.0 settings but that causes a whole host of other problems and doesn’t really tell me why I can’t have two instances of the same base class (but different class linkage) with the same instance names inside seperate movieclips.

Does this make sense to anyone? Not sure if I explained it well enough but this has been bugging me for a few days.

Help? :d:
