Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"DocumentClass doesn't contain a method update" error using OpenFL #17

Open
Anheurystics opened this issue Jan 16, 2016 · 6 comments
Open

Comments

@Anheurystics
Copy link

I tried to see if I can integrate this system into OpenFL, but all I get is the error above, with "Build failure".
lime [2.8.3]
openfl [3.5.3]
thx.core [0.39.0]
edge [0.7.0]

Code is here:

package;

import edge.ISystem;
import edge.World;
import openfl.display.Sprite;

class Main extends Sprite implements ISystem
{   
    public function new()
    {   
        super();

        var world = new World();

        world.render.add(this);
        world.start();
    }

    function update()
        trace("hello");
}

Sorry if I'm actually missing out an important detail here.

@fponticelli
Copy link
Owner

I will try to look into it tomorrow. I am using haxe dev and it looks like OpenFL doesn't work with it.

@Misiur
Copy link
Contributor

Misiur commented Jul 13, 2016

Hello, any news on this? All I could find was that OpenFL in fact creates a class DocumentClass extending the Main (at least for html5 target - https://github.com/openfl/openfl/blob/a9f8b0624cf6f4bc762395a262ae687dec746f37/templates/haxe/ApplicationMain.hx#L223).

@fponticelli
Copy link
Owner

I really haven't tested it but Edge doesn't assume anything special about the environment. I will check ASAP but don't hold your breath ;)

@Misiur
Copy link
Contributor

Misiur commented Jul 14, 2016

I've added debug print in BuildSystem and using the code from first post in this issue

macro public static function complete() : Array<Field> {
    trace(Context.getLocalClass());

And I've got

D:/Programs/Haxe/haxe/lib/edge/0,7,0/src/edge/core/macro/BuildSystem.hx:17: Main
D:/Programs/Haxe/haxe/lib/edge/0,7,0/src/edge/core/macro/BuildSystem.hx:17: DocumentClass
D:/Programs/Haxe/haxe/lib/edge/0,7,0/src/edge/ISystem.hx:5: characters 2-11 : DocumentClass doesn't contain a method `update`

Sorry if it's not helpful at all, just trying to wrap my head around macros.

@Misiur
Copy link
Contributor

Misiur commented Jul 14, 2016

Sorry for spamming. Simplified version of the problem:

class Foo implements ISystem
{
    private function update()
    {
        trace("Boop");
    }
} 

class Bar extends Foo {}
D:/Programs/Haxe/haxe/lib/edge/0,7,0/src/edge/ISystem.hx:5: characters 2-11 : Bar doesn't contain a method `update`
D:/Programs/Haxe/haxe/lib/edge/0,7,0/src/edge/ISystem.hx:5: characters 2-11 : Build failure

Bonus: Ugly, possibly harmful workaround for Main entry for openFL class: https://gist.github.com/Misiur/9023d8d2616a16173cfa18c12e003b49 disregard that, it causes more mayhem and runtime errors

@fponticelli
Copy link
Owner

During the weekend I tried to install openfl (v.4) and failed ... the setup command doesn't work. I will try to follow-up on that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants