package { import away3d.containers.View3D; import away3d.core.utils.Cast; import away3d.lights.DirectionalLight3D; import away3d.materials.PhongBitmapMaterial; import away3d.primitives.Sphere; import flash.display.Sprite; import flash.geom.Vector3D; [SWF(width="500", height="200", frameRate="60", backgroundColor="#FFFFFF")] public class ExPhongBitmapMaterial extends Sprite { [Embed(source="resources/earthmap1k.jpg")] private var earthBitmap:Class; public function ExPhongBitmapMaterial() { var view:View3D = new View3D({x:250,y:100}); addChild(view); var earthMaterial:PhongBitmapMaterial = new PhongBitmapMaterial( Cast.bitmap(earthBitmap) ); var sphere:Sphere = new Sphere({material:earthMaterial}); view.scene.addChild(sphere); // We'll need some light sources to see anything var light:DirectionalLight3D = new DirectionalLight3D(); // Move the light away from the default 0,0,0 position so we'll see some reflection light.direction = new Vector3D(500,-300,200); view.scene.addLight(light); view.render(); } } }