Resizing the view window when the user resizes their browser

Software: Away3D 4.x

Somokon, Member
Posted: 20 August 2011 12:38 AM   Total Posts: 75

Hello all,

Not really an Away3D issue, but I seem to be stuck on what I thought would be a very simple feature.  I want to resize the View3D based on the current size of the browser window.

I set my stage.scaleMode to StageScaleMode.NO_SCALE, and I am listening for an Event.RESIZE event on my stage, but I cannot get this event to ever fire when resizing my browser.

I remember seeing similar code in an example somewhere but I can’t remember if it every worked.

Anyone have any insight into this?

   

Richard Olsson, Administrator
Posted: 20 August 2011 01:15 PM   Total Posts: 1192   [ # 1 ]

Is your SWF filling the entire browser window, or at least using a relative measurement for dimensions (e.g. 100% or any other percentage-based measurement)? If not, the SWF will not resize when the browser resizes, which would explain why you don’t get the event.

   

Somokon, Member
Posted: 20 August 2011 08:42 PM   Total Posts: 75   [ # 2 ]

Thanks Richard, I got it to work.

   

Mark Crossley, Newbie
Posted: 13 October 2011 01:56 PM   Total Posts: 4   [ # 3 ]

I am having a similar problem. I have converted a project from Away3D 3.6 to 4.0, the movie is set to 100% width/height in the HTML.

When I resize the browser (or standalone Player) the Away3D stats display rescales itself as if the view is being rescaled, but the sole object in the view (a sphere) does not resize, nor does the view area resize. It works fine when compiled as version 3.6.

I suspect it is something to do with the camera orthoganal lens I am using?

   

Avatar
TheSillyOne, Newbie
Posted: 01 November 2011 11:51 AM   Total Posts: 28   [ # 4 ]
private function initialize():void
{
 this
.stage.scaleMode StageScaleMode.NO_SCALE;
 
this.stage.align StageAlign.TOP_LEFT;
   
 
this.stage.addEventListener(Event.RESIZEhandleViewResize);
}

private function handleViewResize(event:Event):void
{
 this
._view.width this.stage.stageWidth;
 
this._view.height this.stage.stageHeight;

Best regards.

   

Avatar
Choons, Sr. Member
Posted: 01 November 2011 04:53 PM   Total Posts: 281   [ # 5 ]

yeah that’s how I do it from within flash. Also check out the Swffit script. Very handy

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X