Ich versuche Greensock LoaderMax in einem Starling Framework Projekt zu verwenden, aber da Starling viele eigene Klassen hat, wie kann ich es mit anderen Klassen arbeiten lassen, die die native Klasse verwenden?
Exp:
package
{
import flash.display.Sprite;
import flash.events.Event;
import starling.core.Starling
[SWF(width="1280",height="800",frameRate="60",backgroundColor="#002143")]
public class Main extends Sprite
{
private var mStarling:Starling
public function Main():void
{
mStarling = new Starling(Game, stage)
mStarling.antiAliasing = 1
mStarling.start()
}
}
}
package
{
import com.greensock.events.LoaderEvent;
import com.greensock.loading.display.ContentDisplay;
import com.greensock.loading.SWFLoader;
import starling.display.Sprite;
import starling.events.Event;
public class Game extends Sprite
{
private var queue:SWFLoader
private var mm:ContentDisplay
public function Game():void
{
if (stage)
init()
else
this.addEventListener(Event.ADDED_TO_STAGE, init)
}
private function init(e:Event = null):void
{
queue = new SWFLoader("MainMenu.swf", {onComplete: completeHandler})
queue.load()
}
private function completeHandler(e:LoaderEvent):void
{
mm = queue.content
addChild(mm)
}
}
}
gibt den Fehler zurück:
Error: Implicit coercion of a value of type com.greensock.loading.display:ContentDisplay to an unrelated type starling.display:DisplayObject.