Hello everyone , I wanted to make a 3D textured cube using AWAY3D engine , after doing some search on the internet I found a tutorial here: “http://www.gotoandlearn.com/play.php?id=165” he uses Away3D 4.0.7 Gold , I use 4.1.6 version the code he used is here :
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Vector3D;
import away3d.containers.View3D;
import away3d.core.base.Geometry;
import away3d.entities.Mesh;
import away3d.entities.SegmentSet;
import away3d.lights.shadowmaps.CubeMapShadowMapper;
import away3d.materials.MaterialBase;
import away3d.materials.SkyBoxMaterial;
import away3d.primitives.CubeGeometry;
import away3d.primitives.LineSegment;
import away3d.primitives.SkyBox;
import away3d.textures.BitmapCubeTexture;
[swf(FrameRate = 60 , width = 640 , hieght = 480)]
public class gadol25 extends Sprite
{
[Embed(source=“1.png”)]
private var I1:Class;
[Embed(source=“2.png”)]
private var I2:Class;
[Embed(source=“3.png”)]
private var I3:Class;
[Embed(source=“4.png”)]
private var I4:Class;
[Embed(source=“5.png”)]
private var I5:Class;
[Embed(source=“6.png”)]
private var I6:Class;
private var view:View3D;
private var cube:Mesh;
public function gadol25()
{
setupScene();
}
private function setupScene():void
{
view = new View3D();
addChild(view);
var bct:BitmapCubeTexture = new BitmapCubeTexture( new I1().bitmapData,
new I2().bitmapData,
new I3().bitmapData,
new I4().bitmapData,
new I5().bitmapData,
new I6().bitmapData);
cube = new Mesh(new CubeGeometry() , new SkyBoxMaterial(bct));
view.scene.addChild(cube);
/*var v0:Vector3D = new Vector3D(0,0,0);
var v1:Vector3D = new Vector3D(100,100,100);
var line:LineSegment = new LineSegment(v0, v1, 0x333333, 0x333333, 1);
var lineSet:SegmentSet = new SegmentSet();
lineSet.addSegment(line);
view.scene.addChild(lineSet);*/
//view.backgroundColor = 0xFF0000;
// view.camera.x = 100;
view.camera.z = -1000;
view.camera.y = 100;
view.camera.lookAt(new Vector3D());
addEventListener(Event.ENTER_FRAME, loop);
}
protected function loop(event:Event):void
{
cube.rotationY ++ ;//= (++cube.rotationY)0;
//trace(“y->”+cube.rotationY.toString());
view.render();
}
}
}
but I cannot see the textured cube , I think there is a problem with this part of the code :“new BitmapCubeTexture( new I1().bitmapData,
new I2().bitmapData,
new I3().bitmapData,
new I4().bitmapData,
new I5().bitmapData,
new I6().bitmapData);”
Please help me