# Inheritance issues inside package

**URL:** <https://forum.kirupa.com/t/inheritance-issues-inside-package/332131>\
**Category:** flash\
**Created:** [February 12, 2014, 12:06am UTC](https://forum.kirupa.com/t/inheritance-issues-inside-package/332131 "2014-02-12T00:06:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FatWednesday](https://avatars.discourse-cdn.com/v4/letter/f/ac8455/32.png) [@FatWednesday](https://forum.kirupa.com/u/FatWednesday)\
**Post date:** [February 12, 2014, 12:06am UTC](https://forum.kirupa.com/t/inheritance-issues-inside-package/332131/1 "2014-02-12T00:06:51Z")

</div>

Hello folks of Kirupa.

Putting together some classes for a project using Flash CS5 and FlashDevelop(for script editing). At first the classes were all just in the root folder with the fla file, none using a specific package, and everything tested ok. Then I decided to clean up a bit, and put some proper folders in it so I made my folder structure look like this.

[SIZE=2]\*- Main.fla

- MainMovie.as
- com  
--------appName  
----------------components  
------------------------BarComponent.as  
------------------------SmallBar.as  
------------------------MediumBar.as  
------------------------BarGroup.as\*[/SIZE]

So now each of the component .as files now have package com.appName.components at the top as the package.  
My bar group contains a Vector or type BarComponent, and SmallBar and Medium bar both extend Bar Component.

However now the code i used to use for adding to the group no longer works. I used to add items to the list like this from MainMovie.as, my document class.

```auto
var bg:BarGroup = new BarGroup();
bg.AddItem(new SmallBar("id1", "label"));

```

Now like I said, before I went a put these in a cleaner folder structure everything was working fine. Now I get this error.  
_ **1067: Implicit coercion of a value of type SmallBar to an unrelated type com.appName.components:BarComponent.** _

The MainMovie.as has the necessary imports at the top. So could anyone point out the mistake I made? or the small gotcha that I’ve missed? It would be much appreciated.

I’ll paste the skeleton code bellow for some of the classes.  
[http://pastebin.com/0f8iF8i0](http://pastebin.com/0f8iF8i0) - MainMovie.as  
[http://pastebin.com/vj9U0z7E](http://pastebin.com/vj9U0z7E) - BarGroup.as  
[http://pastebin.com/7mvtd40a](http://pastebin.com/7mvtd40a) - BarComponent.as  
[http://pastebin.com/4MLKCMhN](http://pastebin.com/4MLKCMhN) - SmallBar.as
