10
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ 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 \$\endgroup\$
    – Honeybunch
    Aug 19, 2015 at 16:16
  • \$\begingroup\$ You will probably get a better answer if you ask at the OpenFL community site \$\endgroup\$
    – ashes999
    Mar 20, 2016 at 2:52

0

You must log in to answer this question.

Browse other questions tagged .