Hmmm, I'm sorry โ I just had another look at it, and apparently I mixed something up. The cache()
method doesn't have that logic I talked about. Perhaps that was in Starling 1.x? ๐ถ
Unfortunately, I didn't find a good workaround yet. I've got to take a longer look at this when I've got more time!
For now, I could only think of the following (quite ugly) hack:
// Create that image, but with normal blend mode
var texture:Texture = Assets.getTexture("starfish");
var image:ImageLoader = new ImageLoader();
image.source = texture;
image.filter = new ColorMatrixFilter();
image.filter.cache();
addChild(image);
// give it one frame time to cache with that blend mode, then switch to a different one.
var count:int = 0;
image.addEventListener(Event.ENTER_FRAME, function onEnterFrame():void {
if (count++ == 1) {
image.blendMode = BlendMode.MULTIPLY;
image.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
});
This will display one frame with the wrong blend mode, I'm afraid. You'll have to try if this is visible when actually playing. Otherwise, you will probably have to choose either blend mode or ColorMatrixFilter.
Remember there's also image.color
as an alternative, and the ColorTransform extension, which is a MeshStyle instead of a filter, which should avoid the problem altogether.