Stage3d NO_SCALE

Software: Away3D 4.x

schemagroup, Newbie
Posted: 16 January 2013 07:47 PM   Total Posts: 2

Hi,

I was just wandering if theres away to not scale Stage3D on resize. I’m using the property scaleMode for stage but that doesn’t work. I looked at the documentation for Stage3d but I see no properties or methods that prevent it from scaling. Please help me thanks for your time, I’ve pasted my code for reference.

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE, onResize, false, 0, true);

function onResize(e:Event):void
{
    trace(“resize!”);
}

- Abel

   

Avatar
loth, Sr. Member
Posted: 18 January 2013 12:23 AM   Total Posts: 236   [ # 1 ]

hum strange question
define view size ?

   

schemagroup, Newbie
Posted: 18 January 2013 01:46 AM   Total Posts: 2   [ # 2 ]

Hi,

Sorry, if my question is confusing or weird since this is the first time I’ve ever used Away3d. Let me be clear what I would like to do is not scale my
3DPlane on stage whenever I resize my browser. I’ve pasted my code to this Post for further clarification.

package
{
 import away3d
.containers.*;
 
import away3d.entities.*;
 
import away3d.materials.*;
 
import away3d.primitives.*;
 
import away3d.utils.*;
 
 
import flash.display.*;
 
import flash.display3D.textures.*;
 
import flash.events.*;
 
import flash.geom.Vector3D;
 
import flash.net.URLRequest;
 
import flash.text.*;
 
 
[SWF(width="1024"height="768"backgroundColor="#000000"frameRate="60")]
 
public class Main extends Sprite
 {
  [Embed
(source="floor_diffuse.jpg")]
  
public static var FloorDiffuse:Class;
  
  private var 
_view:View3D;
  private var 
_plane:Mesh;
  
  public function 
Main()
  
{
   this
.addEventListener(Event.ADDED_TO_STAGEonAddedToStageHandlerfalse0true);
  
}
  
protected function onAddedToStageHandler(e:Event):void
  {
   
try
   
{
    
if(this.hasEventListener(Event.ADDED_TO_STAGE))
    
{
     this
.removeEventListener(Event.ADDED_TO_STAGEonAddedToStageHandler);
     
initStage();
     
initAway3d();
    
}
   }catch
(e:Error){
    trace
(e.message);
   
}
  }
  
protected function initStage():void
  {
   trace
("Init Stage!");
   
stage.scaleMode StageScaleMode.NO_SCALE;
   
stage.align StageAlign.TOP_LEFT;
   
stage.quality StageQuality.BEST;
  
}
  
protected function initAway3d():void
  {
   _view 
= new View3D();
   
_view.camera.= -600;
   
_view.camera.500;
   
_view.camera.lookAt(new Vector3D());
   
this.addChild(_view);
   
   
_plane = new Mesh(new PlaneGeometry(700700), new TextureMaterial(Cast.bitmapTexture(FloorDiffuse)));
   
_view.scene.addChild(_plane);
   
   
   
addEventListener(Event.ENTER_FRAME_onEnterFrame);
   
stage.addEventListener(Event.RESIZEonResize);
   
onResize();
  
}
  
/**
   * mesh listener for mouse up interaction
   */
  
protected function _onEnterFrame(ev:Event) : void
  {
   _plane
.rotationY += 1;
   
_view.render();
  
}
  
  
/**
   * stage listener for resize events
   */
  
protected function onResize(event:Event null):void
  {
   _view
.width stage.stageWidth;
   
_view.height stage.stageHeight;
  
}
 }
   

Qbrain, Member
Posted: 18 January 2013 04:28 PM   Total Posts: 92   [ # 3 ]

If you wish not to resize your stage, simply remove the eventlistener for stage resize and the function for it.

If you want the plane ON your scene to stay the exact same size while you are resizing the stage. I think you need to change the with and height of your plane relative to the stageheight and width in the resize function..

As far as I know, there is not a “keep the same height/width on resize” property in Away3D.

-Q

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X