Direct comparison of medium sized game Flash/AS3 vs. OpenFL/Haxe + Issues

Hi,

I have a problem. This darkening/brightening I am talking about has event handling setup to
ignore events on darkener but enable events on brightener area. This is done via
stage mouse over event listener that just uses mouseEnabled. It enables it if to ignore mouse events
or disabled it to have mouse events be handled by other display object.

The display object hierarchy looks like:

DisplayObject1
	DisplayObject1.1
		...
			...
	DisplayObject1.2
		...
			....
	DisplayObject1.3
		...
			....
	DarkenerStage-DisplayObject via Shape
		Brightener-DisplayObject via Shape

So now the problem! It works with OpenFL 6.5.0 but not with current OpenFL 7.x.y.

Any ideas? Was there any relevant change that might cause the different behaviour?

Best regards
Andreas

The development branch of OpenFL has improvements for custom shader rendering per display object, which might be a good approach if you are used to using a shader for this anyway.

What is the issue here that is different in OpenFL 7? Is it a display list heirarchy using blend modes, or something different? Just trying to understand this issue

Hi,

I thought there might be a OpenFL/Flash solution for that. The original code uses some blend modes of Flash which are not supported on OpenFL. This it at least what the api.openfl.org said.

For the event handling thing I can try to set up a test case and see if its reproducible there. I will do this once I have time.

Best regards
Andreas

Hi,

I have another question. I programmed a preloader which includes a music track. Is this supported?
Because everything compiles but I do not hear any sound and I also see no exception or something in Console.

I have something like:

 @:sound("Assets/preloader/Music.mp3") class LoadingMusicSound extends Sound {}

...

class Preloader extends Sprite {

	...
	private var loadingMusic : SoundChannel;
	...

	public function new () {
		super();

		// play preloader music
		var loadingMusicSound: Sound = new LoadingMusicSound();
		loadingMusic = loadingMusicSound.play(0.0, 1, new SoundTransform(1.0, 0.0));
		...
	}

	...

}

Many thanx and

Best regards
Andreas

Hi,

any news here regarding music in preloader and regarding color blending (darkening) ?

Best regards
Andreas

@andreasdr If you want to use an asset before it is loaded by the preloader, you need to mark it as non-preloaded, and load it explicitly using Asset.loadSounds, similar to this answer:

Not sure about darkening - you can probably use a ColorMatrixFilter for that, but I’d advise against using it if you target Canvas 2D where it may be extremely slow.

1 Like

Hi,

I have another question. If using filters on text field everything works while having a first look.
But then If I change the text the changed text does seem to be rendered but the old one.
So I guess the cached bitmap with filter applied will not be resetted when changing the text.

Any hint how to force to render new texts? I tried unsetting filter and put .cacheAsBitmap = false and such.
Nothing worked :frowning:

Best regards
Andreas

Would be useful to specify your target (c++ or web? dom, canvas or webgl?..).
With all the different backend combinations the caching logic of the TextField is rather complex. cc @singmajesty

TextField + cacheAsBitmap should work, but again, perhaps there is some combination that isn’t quite working, that we’ll need to figure out. Perhaps it’s TextField + filters, we are doing work on filters now in dev, so we’ll be re-testing that soon as we update it for hardware render-to-texture

Hi

I am using HTLM5/WebGL. I will try to just recreate that textfield with filters right now as work around.
I can provide a test app though If you are interested.

Thanx for your help.

Best regards
Andreas

That would be awesome if that’s not too much trouble

Hi,

Do you mean you want a test app or do you mean you want me to do the work around?
My work around works already!!!

Many thanx and

Best regards
Andreas

Oh, well if you have a simple reproduction case in a few lines of code, that would be great. The workaround seems pretty clear. Either way, I hope to revisit this soon, so no worries if you don’t write a test case

1 Like

Hi,

I have a again another question.

I have a font that works with MacOSX/Safari + MacOSX/Chrome + MacOSX/FireFox but not with any browser in Windows 10.

It does not show something crappy or wrong. It just does show a different font. Thats crazy.

When I compile the project no error warning is displayed too.

And in FireFox fonts are displayed at a different y position than in Chrome on MacOSX.

As I have lots of problems with Fonts is there a way to use e.g. bitmap fonts?
Or does anyone of you have ideas what could be wrong?

Any hints?

UPDATE: MacOSX seem to use installed fonts. If I delete those fonts from OS they are not working in MacOSX too.

Does it maybe help to insert the fonts via CSS own my own?

Many thanx!

Best regards
Andreas

You should be able to add your own webfonts, we use webfont CSS font names when doing TextFormat font names on HTML5.

Baseline font support is not available in all browsers, which means we have to sort of guess, which isn’t always right :frowning:

There’s changes to Lime in the last release that adds correct measurements to our exported font information. We need to update OpenFL to use this information so we can have more accurate rendering, at least for fonts you embed at compile-time. We’ll doing something similar to this (but without removing CSS webfont support)

1 Like

Hi,

hmm. Including the fonts OpenFL generated in CSS manually works!!! Whats the difference?
Would prefer the OpenFL way first since we want to try a Android and IOS port later too.

Any hints?

For now I can work as it is.

Thank you very much.

Best regards
Andreas

There’s changes to Lime in the last release that adds correct measurements to our exported font information. We need to update OpenFL to use this information so we can have more accurate rendering, at least for fonts you embed at compile-time. We’ll doing something similar to this (but without removing CSS webfont support)

Very nice! This will fix font rendering even using CSS with FF as I can add metrics manually.

That’s curious! Is it a difference in the HTML side, in how the CSS is done, or is it a different in the font format name string, in the Haxe side?

Hi,

for now I am doing exactly both. This is the only way it works 100% on all platforms reliable.
Including the fonts as assets in OpenFL AND including them with CSS manually.

Maybe I can check next week whats going wrong.

Many thanx!

Best regards
Andreas

1 Like

Hi,

I have a short question based on my observations.

In Flash it seems like the following TextField things are working like:

  • when having a restrict you still can set text programmatically which bypasses it
  • when having maxChars you stil can set text that is longer than max chars

In OpenFL both properties seem to affect text when setting it programmatically.

This is my observations, but I am not 100% sure. Maybe I can make a test case to validate.

What do you think?