Orientation Bugs

Software: Away3D 4.x

Lucid, Member
Posted: 14 March 2012 09:44 AM   Total Posts: 93

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.

 

   

Avatar
Fabrice Closier, Administrator
Posted: 14 March 2012 10:31 AM   Total Posts: 1265   [ # 1 ]

Yes, that’s an issue we are aware of. It will be fix asap.

   

Lucid, Member
Posted: 14 March 2012 10:41 AM   Total Posts: 93   [ # 2 ]

@ Fabrice

Thank you for the news. Once this has been resolved (fixed), could you please provide information on which method (if any) would be needed to properly resize the View3D or orientation / resize changes? This would spare us from having to perform a myriad of experiments to get it right. Ideally, the View3D itself would have a parameter that would allow you to set a parameter such as view.fullscreen=true. This would set up listeners on the View3D to force it to resize properly when it’s ‘parent’ is resized (whether that’s on the Stage in an .as project or, additionally, when the parent mx:UIComponent or s:SpriteVisualElement container is resized.

   

GameDesigner, Jr. Member
Posted: 17 March 2012 12:46 AM   Total Posts: 33   [ # 3 ]
Lucid - 14 March 2012 10:41 AM

@ Fabrice

Thank you for the news. Once this has been resolved (fixed), could you please provide information on which method (if any) would be needed to properly resize the View3D or orientation / resize changes? This would spare us from having to perform a myriad of experiments to get it right. Ideally, the View3D itself would have a parameter that would allow you to set a parameter such as view.fullscreen=true. This would set up listeners on the View3D to force it to resize properly when it’s ‘parent’ is resized (whether that’s on the Stage in an .as project or, additionally, when the parent mx:UIComponent or s:SpriteVisualElement container is resized.

I’m getting the same problem and need that feature too.

Once this has been fixed, temporarily put fullScreen to false in app.xml

wink

   

Raj, Newbie
Posted: 11 September 2012 04:42 AM   Total Posts: 9   [ # 4 ]

Is this issue fixed?

   

Sandra, Newbie
Posted: 20 September 2012 01:11 PM   Total Posts: 3   [ # 5 ]

I had the same problem. For any unknown reason, in my project it helps to call a single view.render() after performing the regular resizing width/height stuff.

this.view.width=stage.stageWidth;
this.view.height=stage.stageHeight;
this.view.render(); 

Of course, I’ve got the same render call in an enterFrame handler so I don’t see why it has to be called twice…

   

niczy, Newbie
Posted: 21 September 2012 08:26 AM   Total Posts: 7   [ # 6 ]

Hi Sandra, thank you for your suggestion, I tried your method and ran it on my tablet and it works now! Not sure why also though…

   

cyberix3d, Jr. Member
Posted: 02 October 2012 09:22 PM   Total Posts: 34   [ # 7 ]

Thank you Sandra,
You saved my life! smile

   

Shaedo, Newbie
Posted: 11 June 2014 06:05 AM   Total Posts: 9   [ # 8 ]

Thanks Sandra (2 years later!) this solution is still working well.

I found that when the view is resized, a view.render() call has to be made before adding new children to the view.

I my case I needed to resize the view before adding it to the stage, so I had to shift resizing the view until after adding the children.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X