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_STAGE, onAddedToStageHandler, false, 0, true);
}
protected function onAddedToStageHandler(e:Event):void
{
try
{
if(this.hasEventListener(Event.ADDED_TO_STAGE))
{
this.removeEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
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.z = -600;
_view.camera.y = 500;
_view.camera.lookAt(new Vector3D());
this.addChild(_view);
_plane = new Mesh(new PlaneGeometry(700, 700), new TextureMaterial(Cast.bitmapTexture(FloorDiffuse)));
_view.scene.addChild(_plane);
addEventListener(Event.ENTER_FRAME, _onEnterFrame);
stage.addEventListener(Event.RESIZE, onResize);
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;
}
}
}