Nothing Renders in Flash target

I do not know what’s going on with my Haxe project, but every other project works and renders correctly while this one simply refuses to render images and text.

I’ve got a pastebin here with the main entry point at the top.

Could someone tell me what exactly I’m doing wrong?

The following libraries I am using are as follows:

OpenFL 2.2.4
Lime 2.0.6
Actuate 1.8.1
HScript 2.0.4
box2d 1.2.3

Thank you in advance for any assistance.

It’s a problem about the TextField

You should load a font from assets and set embed to true
I also recommend to use the autosize option (in your project it is truncated now and selectable)
here’s the code for MenuBar (put a font in the assets as well!)

import openfl.text.TextFieldAutoSize;
var font = Assets.getFont ("assets/thefontyouwant.ttf");
_title = new TextField();
_title.defaultTextFormat = new TextFormat(font.fontName, 16, 0xFF0000, true);
_title.autoSize = TextFieldAutoSize.LEFT;
_title.embedFonts = true;
_title.selectable = true;
_title.wordWrap = false;
_title.border = false;
_title.text = Text;

have a nice day/night

Thank you for your help, but unfortunately that did not solve my problem. I have changed my TextField to embed fonts, used both my Fonts class and your method, and neither changed the “missing objects” problem that I am encountering.

The objects are added but nothing appears. I am aware of setting the “width” and “height” properties of sprites, and using scaleX and scaleY would fix the rendering issues, but I thought that was only AFTER the object had been added to the scene/stage. So - once again - I’m baffled as to what the problem is.

I’ve put my source code on Github now.

First of all when I tried to compile there was a
src/Fonts.hx:99: characters 7-9 : Unexpected if

anyway, I’ve fixed it and applied some tweaks as well.
this is the fix (I’ve already submitted a pull request to you)

In the end I found EXACTLY what was the problem


27.   _menuBar.width = stage.stageWidth;

If you comment this line in your project it works.
Not entirely sure why actually.
But it looks like you scale the Sprite (I’ve tried to draw on graphics a square and it was scaled, looking like a long rectangle)

Sorry if I mislead you before.
Anyway I’ve tried to give you some cleaningness in the pull request

Have a good day

1 Like