Thanks – ES5 is fine and the Haxe output is compatible. My fault – I didn’t understand a particular ES5 capability.
Right now I have a “Hello World” app I’m trying to get running on an Android phone in WeChat. It works flawlessly in the WeChat simulator, but on the phone I just get a black screen. At this point I don’t have a clue. I added some straight canvas code to see if that would draw. I never see the OpenFl drawing, but the straight canvas code I added displays correctly:
Main.prototype = $extend(openfl_display_Sprite.prototype, {
init: function (event) {
this.removeEventListener("addedToStage", $bind(this, this.init));
console.info("drawing in haxe");
// this works in the simulator, but not on an Android phone:
var rect = new openfl_display_Sprite();
rect.get_graphics().beginFill(16711680);
rect.get_graphics().drawRect(0, 0, 200, 200);
rect.get_graphics().endFill();
rect.set_x(0);
rect.set_y(50);
this.addChild(rect);
}
, __class__: Main
});
//-----------------------------------------------------------------------------
// main app
exports.lime.embed("HelloWorld", canvas, canvas.width, canvas.height, { parameters: {} });
console.info("drawing in js");
// this works:
// use the canvas global object to see if it will draw anything
var ctx = canvas.getContext("2d");
var grd = ctx.createLinearGradient(0, 0, 200, 0);
grd.addColorStop(0, "blue");
grd.addColorStop(1, "white");
ctx.fillStyle = grd;
ctx.fillRect(10, 10, 150, 80);
Just to be clear in the console I see:
drawing in haxe
drawing in js
Not sure how to debug this.
Cheers,
Rick