Resizing a Stage3dProxy not working

Software: Away3D 4.x

mb85, Newbie
Posted: 10 May 2013 02:02 PM   Total Posts: 14

I have a Starling instance and an Away3d instance operating together through a Stage3DProxy. Everything is positioned fine during the initial window setup. I’m having a tough time getting the Stage3D stuff to resize correctly when the user resizes the app window. The Away3D instance becomes all distorted - if the user makes the window bigger, the Away3D stuff is squeezed horizontally. If they make it smaller, it is stretched horizontally.

Can anyone explain what properties I need to target in my resize handler to get this stuff to scale correctly? I get the weird distortion any time I try to set these properties:

//With this code in the resize handler, the away3d instance becomes badly distorted (stretched/squeezed horizontally) when resized
stage3DProxy.width stage.stageWidth;
stage3DProxy.height stage.stageHeight

When I only set the following properties, I get correct scaling, but the viewPort clips to the original window size:

_view.width stage.stageWidth//set the View3D width
_view.height stage.stageHeight//set the View3D height
   
_background.root.width stage.stageWidth//set the Starling instance width
_background.root.height stage.stageHeight//set the Starling instance height 


Any help would be hugely appreciated. Thanks!

   

mb85, Newbie
Posted: 14 May 2013 04:13 PM   Total Posts: 14   [ # 1 ]

Gah, I’m so close to getting this working. I added a call to stage3DProxy.configureBackBuffer and now have what appears to be 2 separate views, one overlayed on top of the other. The one in front does not scale correctly, the one in back does. Anyone know why I’d be seeing 2 duplicate views after a call to configureBackBuffer? I just need to get rid of the one in front and it will be working perfectly.

   

jeremyp, Newbie
Posted: 11 November 2013 12:39 AM   Total Posts: 4   [ # 2 ]

Were you ever able to get this working? I am having the same issue.

   

andreahmed, Member
Posted: 11 November 2013 04:27 PM   Total Posts: 62   [ # 3 ]

I have ran into that problem last two weeks and I fixed it.

when you change your stage3dProxy.width, and height.
Please assign the new dimensions to the VIEWPORT again.

Let me know if that helps.

   

jeremyp, Newbie
Posted: 12 November 2013 02:49 AM   Total Posts: 4   [ # 4 ]

Thanks so much andreahmed! Not sure if it’s what you had in mind, but after resetting the width/height of the View3D container after resizing the stage3DProxy, my objects were no longer squeezed vertically. I’m still not entirely sure of what magic is going on to fix the issue, but I’m happy enough the issue is gone. Been trying different approaches for weeks and this is the only thing that’s shown results. Again, thanks, thanks, so much!

   

flexwiz, Newbie
Posted: 07 March 2014 09:20 PM   Total Posts: 14   [ # 5 ]

Hi, I am having a similar problem now, in the app resize.

Could you please post the code that worked for you?

   

teonicel, Newbie
Posted: 15 May 2014 03:35 PM   Total Posts: 1   [ # 6 ]

private function updateView():void {
if (view.stage) {
  _width = stage.stageWidth;
  _height = stage.stageHeight;
 
 
  if (away3dView) {
  away3dView.width = _width;
  away3dView.height = _height;
  }
  if (starlingLayer) {
  starlingLayer.stage.stageWidth = _width;
  starlingLayer.stage.stageHeight = _height;
 
  }
 
  stage3DProxy.width = _width;
  stage3DProxy.height = _height;
  stage3DProxy.viewPort.width = _width;
  stage3DProxy.viewPort.height = _height;
 
}
}

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X