There appears to be an issue with orientation in regards to the View3D. After the device (iOS or Android) has been rotated, the View3D either doesn’t resize properly or, if it does, it does not display ANY of the objects that were originally placed there.
——-
1. I’m using Flex and yes the background is set to 0
2. I have:
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
3. I’ve used both a mx:UIComponent and a s:SpriteVisualElement to hold the view3D
4. When using the mx:UIComponent, I’m able to create a resize event handler to listen for changes to the size. An example would be this:
<mx:UIComponent id=“window” width=“100%” height=“100%” resize=“resize(event)”>
// calls this function
protected function resize(event:ResizeEvent):void {
try{view.width = window.width
view.height = window.height
view.camera.position=new Vector3D(0,0,0);}catch(e:Error){};}
5. I have also tried attaching a resize event listener to the stage, like this:
stage.addEventListener(Event.RESIZE,resize)
protected function resize(event:ResizeEvent):void {
try{view.width = window.width
view.height = window.height
view.camera.position=new Vector3D(0,0,0);}catch(e:Error){}; }
6. I have also tried attaching an orientation listener like this:
stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE,orient)
protected function orient(event:StageOrientationEvent):void {
try{view.width = unscaledWidth;
view.height = unscaledHeight;
view.camera.position=new Vector3D(0,0,0);}catch(e:Error){}}
Now, the only thing that properly resizes the View3D is #4, where I attach a resize event listener directly to the mx:UIComponent. While this appears to resize the View3D element properly, all objects are not visible. They could be off screen or not rendered (I think the former). For example, I have a sphere in the center of the screen (with a z value of 2000 so I can see it). When the application first starts I see the sphere just fine. But when the device is rotated the sphere is no longer visible at all. This could either be that the View3D is not resizing properly or the object rendering is not functioning after rotation. I’ve tried many combinations of event listeners and values changes (setting the View3D’s x and y properties and width/height properties) but I’ve not seen any solution.
I’ve not had any of these issues in Away 3.6. Only in 4.0.
Thoughts?
UPDATE: I’ve also tried using NO listeners that would update the View3D on a resize or orientation change. The results are exactly the same. I am attaching two screenshots from my Android Galaxy Tab 7.7 plus. The first shows the device opening in portrait mode and shows the sphere properly in the center. The 2nd image shows what the application looks like when the device is rotated. Note, the results are the same if the application is originally opened in landscape and rotated to portrait.