Return to Snippet

Revision: 37303
at December 8, 2010 05:48 by adamcoulombe


Initial Code
import away3d.cameras.*;
import away3d.containers.*;
import away3d.materials.*;
import away3d.primitives.*;

// import com.greensock.*;

var scene:Scene3D;
var camera:Camera3D;
var view:View3D;
var myCube;

init();

function init():void
{
	initEngine();
	initObjects();
	stage.addEventListener(Event.RESIZE, stageResize); stageResize();
	addEventListener(Event.ENTER_FRAME,loop);	
}

function loop(e){
	// TweenLite.to(myCube,0.5,{rotationX:mouseY-stage.stageHeight/2,rotationY:mouseX-stage.stageWidth/2});
	view.render();
}

function initEngine():void
{
	scene = new Scene3D();
	camera = new Camera3D({z:-51});
	view = new View3D({scene:scene, camera:camera});
	addChild(view);
}

function initObjects():void
{
	var material = new ColorMaterial("ff0000");
	myCube = new Cube({material:material, width:250, height:250, depth:250});
	scene.addChild(myCube);
}
function stageResize(event:Event = null):void
{
	view.x = stage.stageWidth / 2;
	view.y = stage.stageHeight / 2;
}

Initial URL

                                

Initial Description

                                

Initial Title
Basic Away 3d Scene Setup

Initial Tags

                                

Initial Language
ActionScript 3