COMMUNITY

Transparent OpenFL Desktop Window Background Confusion


(Hassan Al Nori) #1

I’m a beginner in Haxe and OpenFL in general but I wanted to see if it’s possible to create a borderless window (can do this) which contains a png image but a transparent background (stage) without having this rectangle window area appearing, yet no matter how much I look up online I can’t find an answer to this specific thing.

Expected (Something like this which I’ve seen done in Flash):
transparentsplash

Current:

.hx file:

package;


import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.display.Sprite;
import openfl.Assets;
import openfl.Lib;

class Main extends Sprite {
	
	
	public function new () {
		
		super ();
		var bitmap = new Bitmap (Assets.getBitmapData ("assets/openfl.png"));

		bitmap.x = (stage.stageWidth - bitmap.width) / 2;
		bitmap.y = (stage.stageHeight - bitmap.height) / 2;
		//stage.alpha=0; //making it 0 will make everything disappear
		//stage.opaqueBackground=0;
		stage.color=0x000000;
		
		addChild (bitmap);

	}
	
	
}

.xml file:

<?xml version="1.0" encoding="utf-8"?>
<project>
	
	<meta title="Displaying a Bitmap" package="org.openfl.samples.displayingabitmap" version="1.0.0" company="OpenFL" />
	<app main="Main" path="Export" file="DisplayingABitmap" />
	<window borderless="true"/>


	<source path="Source"/>
	
	<haxelib name="openfl"/>
	
	<assets path="Assets" rename="assets" />
	
</project>

Thank you so much for your time :heart_eyes:


(Valentin Lemière) #2

OpenFL use SDL which doesn’t seem to be able to do that, so I don’t think you can.
But you should ask your question on the openfl forum to have confirmation.