I'm trying to implement a basic SceneManager using OpenFL and Haxe. I don't have a lot of experience using OpenFL and Haxe so I have a few problems.

Here is how I designed the SceneManager class:

package;

import openfl.display.Sprite;
import openfl.Lib;

class SceneManager extends Sprite
{
    private var currentScene: ...;

    public function new(rootScene: ...)
    {
        super();

        currentScene = rootScene;
        Lib.current.addChild(currentScene);
    }

    public function changeScene(newScene: ...): Void
    {
        Lib.current.removeChild(currentScene);

        currentScene = newScene;
        Lib.current.addChild(SceneTwo);
    }
}

The "..." should be replaced with a general "class" type that can hold any of my scenes.

If anyone can help me solve this I would be really grateful.

share|improve this question
    
It's hard to have a SceneManager if you don't also have a Scene class. I think normally you'd write a Scene class that stored all the info you needed and then have a static List of Scenes in your Scene Manager – Honeybunch Aug 19 '15 at 16:16
    
You will probably get a better answer if you ask at the OpenFL community site – ashes999 Mar 20 '16 at 2:52

You could look into new lib Screen Manager for OpenFL. Their ScreenManager class is here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.