Reputation: 5276
I'm new to Flash development and I'm trying to work with Starling, but I'm having trouble getting my tutorial project to run. The most difficult part has been finding a good setup guide. The Starling guide is quite outdated. Here's what I've done.
C:\Users\Noah\Dev Stuff\Flash Dev\DemoHungryHeroASC\src\Main.as:21: Error: Implicit coercion of a value of type Stats to an unrelated type DisplayObject.
C:\Users\Noah\Dev Stuff\Flash Dev\DemoHungryHeroASC\src\Main.as:23: Error: Implicit coercion of a value of type Stage to an unrelated type Stage.
Here's my code. What do you think? Thanks!
Main.as
package
{
import net.hires.debug.Stats;
import starling.core.Starling;
import starling.display.Sprite;
/**
* ...
* @author NSouth
*/
public class Main extends Sprite
{
private var stats:Stats;
private var myStarling:Starling;
public function Main():void
{
stats = new Stats();
this.addChild(stats);
myStarling = new Starling(Game, stage);
myStarling.antiAliasing = 1;
myStarling.start();
}
}
}
Game.as
package
{
import starling.display.Sprite;
import starling.events.Event;
/**
* ...
* @author NSouth
*/
public class Game extends Sprite
{
public function Game()
{
super();
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(event:Event):void
{
trace("this was initialized");
}
}
}
Upvotes: 0
Views: 340