[HTML5] possibility to execute methods / change property value via browser console

Possible? If yes, how?

Sure. Just use @:expose on the classes you want access to.

2 Likes

Hm. But how to access test method via console? Still didn’t get it

package samples.fla;

@:expose
class Test
{
	public function new()
	{
	}
	
	public function test():Void
	{
		trace("test!");
	}
}

And this is the main class:

@:expose
class AbstractApp extends openfl.display.Sprite
{
    private var test:Test;

    public function new()
    {
        super();

        test = new Test();
    }
}

I believe Lime includes a wrapper around the Haxe output by default in order to allow for multiple embeds on a webpage without global variables colliding with each other.

I think you can get a reference to the application by saving the returned value from lime.embed

var app = lime.embed(...);
console.log(app.ExposedMethod());

OpenFL also supports ExternalInterface which I believe attaches methods to the DIV ID used when embedding your project. There is a sample in openfl-samples that illustrates how it works :slight_smile:

That’s not exactly what I want.
I want to be able to call haxe methods via chrome console for testing purposes.
Or I didn’t understand you :slight_smile: