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?
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
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.
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));
...
}
...
}
@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.
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
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
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.
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
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
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)
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.
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.
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.