Hi all,
I was wondered how many people on here are using Away3D + Starling? The reason I ask is because I'm having a strange problem re : resizing the stage.
When Event.RESIZE is triggered, I use Starlings RectangleUtil.fit to find the best fit rect for the stage size. I then set the stage3DProxy position and width to this rectangle and also set Starlings viewport to these coordinates too. I also change the width of the current Away3D view.
protected function onStageResize(e:Event):void
{
// get best fit rect for set stage size and new stage size
var bestRect:Rectangle = RectangleUtil.fit(new Rectangle(0, 0, BBDisplaySettings.stageWidth, BBDisplaySettings.stageHeight), new Rectangle(0, 0, stage.stageWidth, stage.stageHeight), ScaleMode.SHOW_ALL);
// resize Away3D viewport
if (_away3DView)
{
_away3DView.width = bestRect.width;
_away3DView.height = bestRect.height;
}
// adjust stage3d proxy size
if (_starling)
{
_stage3DProxy.width = bestRect.width;
_stage3DProxy.height = bestRect.height;
_stage3DProxy.x = bestRect.x;
_stage3DProxy.y = bestRect.y;
_starling.viewPort = bestRect;
}
}
On first impression, this seems to work but when I try to project a 3D coordinate to 2D, the position is incorrect. However, if I don’t adjust the view3D size, the position IS correct BUT the view3D instance doesn’t scale to fit the screen and stays the same size in the top left corner.
I know it's probably an Away3D problem, I was just wondering if any of you had experienced this?