Closed TerryCavanagh closed 7 years ago
(here's the source code from the zip above:)
package;
import starling.core.*;
import starling.display.*;
import starling.textures.*;
import starling.events.*;
import openfl.Assets;
class Game extends Sprite {
public function new() {
super();
addEventListener(Event.ADDED_TO_STAGE, onAdded);
}
public function onAdded(e:Event) {
var tempimg:Image = new Image(Texture.fromBitmapData(Assets.getBitmapData("assets/starlingbird.png"), false));
addChild(tempimg);
}
}
Also of note, the exception is thrown before any ResizeEvents are captured
Does anyone have an environment where they can test the ActionScript version of Starling 1.8, and see if it has the same behavior? I'm not set up to compile ActionScript
Thanks :smile:
Ok, just checked! I'm attaching an AS3 starling 1.8 project that does the same thing as the haxe example. It doesn't have the crash on resize!
(really happy you're looking into this!)
Looks like context gets lost when you resize FlashPlayer window. (I saw the stack trace with debug version of FlashPlayer).
With higher Context3DProfile (such as baselineExtended) context doesn't get lost, but https://github.com/openfl/starling/issues/31 prevented Starling from using best available profile. You should be able to avoid this issue by passing "auto" (or any profile you want) to profile parameter.
I'm not sure why Starling fails to restore lost texture though. Std.is
failed to work on flash somehow? Then why Type.getClassName
worked?
Should we use getQualifiedClassName
instead, like original AS3 version?
Thanks guys, it seems to work now! :smile:
Ahh, nice! Thank you :D
Hey again! I've been trying to figure out why I can't get resizing to work with my Starling app, and I think it might be due to a bug in haxe Starling. Using the current v1.8 branch, trying to resize a window with any textures in it causes a crash.
Here's a simple example project:
resizebug.zip
This program
in
starling.textures.ConcreteTexture.hx
, functioncreateBase()
, line 251.(I currently can't build on any target other than flash (https://github.com/openfl/starling/issues/25), so I don't know if this only affects flash, or if affects all targets.)