I'm following hemanth sharma's excellent tutorial series on the starling framework. I more or less copied his code and made a few changes towards the game I have in mind. The code is 80% the same he used in his project. Nevertheless I'm encountering a strange error: "error 1067" it complains about the "implicit coercion" of supposedly unrelated types.
I browsed previous questions and discovered this one:
1067: Implicit coercion of a value of type Class to an unrelated type flash.display:DisplayObject
The error message I'm receiving is basically the same but unfortunately the solution does not apply to my problem. Moreover I'm getting this error in many interesting different flavours.
I've got a custom event class called NavigationEvent that expands starling.events.Event. When the used tries to switch between the game screens this event is dispatched. Here's some code:
import starling.events.Event; public class NavigationEvent extends Event
it is dispatched like this:
this.dispatchEvent(new NavigationEvent(NavigationEvent.CHANGE_SCREEN,{id:"play"},true));
the error message says:
Error 1067: Implicit coercion of a value of type events:NavigationEvent to an unrelated type starling.events:Event
The code worked fine when I first wrote it but now, after I've changed another part of the program it is broken. I can't explain it. I extended NavigationEvent from starling.events.Event so the types are definitely not unrelated. I even ran the program like this. Admittedly the routine to switch between screens was no yet implemented but the event was fired without problems.
In order to let the user trigger this event I added a button to the screen. It is starlings standard
starling.display.Button;
. The button is a member variable of my screen classprivate var playBtn:Button;
However this line results in an error:
playBtn=new Button(Assets.getAtlas().getTexture("play"));
This time the error is even more outrageous:
Error 1067: Implicit coercion of a value of type starling.textures:Texture to an unrelated type starling.textures:Texture
What can I do about this ?