Hi, I have a problem setting a texture for a cube, when I compile, Flash don’t show errors, but when I reproduce in the Browser, the texture it seems missing, it just show the color of the light, what I could be wrong?
import away3d.containers.View3D;
import away3d.lights.DirectionalLight;
import away3d.lights.LightBase;
import away3d.lights.PointLight;
import away3d.materials.BitmapMaterial;
import away3d.primitives.Cube;
import away3d.primitives.Plane;
import away3d.primitives.Sphere;
import away3d.containers.ObjectContainer3D;
import away3d.materials.ColorMaterial;
import flash.display.BitmapData;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.utils.getTimer;
const dec:uint=10;
var _view : View3D;
var _ctr : ObjectContainer3D;
var _light : PointLight;
_view=new View3D();
_view.backgroundColor=0xFFFFFF;
this.addChild(_view);
this.addEventListener(Event.ENTER_FRAME, _handleEnterFrame);
_ctr = new ObjectContainer3D();
var image:BitmapData = new cancha();
var pasto:BitmapMaterial = new BitmapMaterial(image.bitmapData);
//pasto.ambientColor = 0x080820;
//var pasto:ColorMaterial=new ColorMaterial(0xFFFFFF);
var cubo:Cube=new Cube(pasto, 500, 10, 500, 11, 7, 25, false);
cubo.y=-300;
cubo.z=300;
/*var esfera:Sphere=new Sphere(pasto, 50, 10, 10);
esfera.y=-250;
esfera.z=-50;*/
_ctr.addChild(cubo);
//_ctr.addChild(esfera);
_light = new PointLight();
_light.x = -2000;
_light.y = -10000;
_light.z = -3000;
_light.color = 0xffeeaa;
pasto.lights = [_light];
_view.scene.addChild(_ctr);
_view.scene.addChild(_light);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
function _handleEnterFrame(ev : Event) : void
{
//_ctr.rotationY += .1;
//_ctr.rotationX = 20 * Math.sin(getTimer() * 0.002);
//esfera.z+=dec;
_view.render();
}
Thanks for your help!