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.
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 - MainMovie.as
http://pastebin.com/vj9U0z7E - BarGroup.as
http://pastebin.com/7mvtd40a - BarComponent.as
http://pastebin.com/4MLKCMhN - SmallBar.as