Starling and Away3D together

Hi,

I need to make Away3D and Starling working together…

In AS3 I used to do something like:

private function initProxies():Void 
{
		trace("initProxies");
		
		_stage3DManager = Stage3DManager.getInstance(stage);
		_stage3DProxy = _stage3DManager.getFreeStage3DProxy(false, _profile);
		_stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, onContextCreated);
		_stage3DProxy.antiAlias = _antiAliasing;
		_stage3DProxy.color = 0x000000;
}
	
private function onContextCreated(event : Stage3DEvent):Void 
{
		trace("onContextCreated");
		
		UiData.WIDTH = stage.stageWidth;
		UiData.HEIGHT = stage.stageHeight;
		
		_stage3DProxy.context3D.configureBackBuffer(UiData.WIDTH, UiData.HEIGHT, _antiAliasing);
		
		initAway3D();
		initStarling();
		initListeners();
}

But in OpenFl, the “Stage3DEvent.CONTEXT3D_CREATED” never fire…

Someone can tell me how I must manage this?

Thanks for your help!

Perhaps try something like:

if (_stage3DProxy.context3D == null) {
     _stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, onContextCreated);
} else {
    onContextCreated(null);
}

The context might already be created

Thanks for your help singmajesty!
in contrary of AS3, the context3D is already there…it works now :slight_smile:

1 Like