I have some classes that implement an interface, but also extend the Sprite class:
package {
public interface IState {
function addMonster():void;
}
}
package {
public class Fuzzy extends Sprite implements IState {
public function addMonster():void {
}
}
}
package {
public class LizardSkin extends Sprite implements IState {
public function addMonster():void {
}
}
}
// Document class
package {
public class Main extends MovieClip {
private var state:IState;
public function Main():void {
state = new Fuzzy();
addChild(state);
}
}
}
When I try to addChild(state) I keep getting an error message 1067: Implicit coercion of a value of type IState to an unrelated type flash.display:DisplayObject.
Now I know I've seen examples where a class extends MovieClip / Sprite and implements an interface...what can I do to make it so I can add "state" to the stage but also implement the methods I want??