Why do i get a blank screen? using simple png files please help me i am stuck

Software: Away3D 4.x

Wernand, Newbie
Posted: 08 January 2014 08:57 PM   Total Posts: 3

I have picked this code from a turorial site and so far i can see there is nothing wrong but when i run this in the flash 11 debugger with flash builder 4.6 i get only a black screen with nothing in it. I have used the flash away3d 4.1 gold edition
confused

package
{
 import away3d
.containers.View3D;
 
import away3d.controllers.HoverController;
 
import away3d.entities.Mesh;
 
import away3d.materials.ColorMaterial;
 
import away3d.materials.SkyBoxMaterial;
 
import away3d.materials.TextureMaterial;
 
import away3d.primitives.CubeGeometry;
 
import away3d.primitives.PlaneGeometry;
 
import away3d.primitives.SkyBox;
 
import away3d.textures.BitmapCubeTexture;
 
 
import flash.display.ColorCorrection;
 
import flash.display.Sprite;
 
import flash.display3D.textures.Texture;
 
import flash.events.Event;
 
import flash.geom.Vector3D;
 
 
[SWF(width=640height=480frameRate=60)]
 
public class BreakingAway 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;
  private var 
hc:HoverController;
  
  public function 
BreakingAway()
  
{
   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);
   
   
view.camera.= -500;
   
view.camera.300;
   
view.camera.lookAt(new Vector3D());
   
   
hc = new HoverController(view.cameranull15010200);
   
   
addEventListener(Event.ENTER_FRAMEloop);
  
}
  
  
protected function loop(event:Event):void
  {
   hc
.panAngle mouseX 320;
   
hc.tiltAngle mouseY 240;
   
   
view.render();
  
}
 }
   

incubus, Newbie
Posted: 08 January 2014 11:12 PM   Total Posts: 21   [ # 1 ]
Wernand - 08 January 2014 08:57 PM

I have picked this code from a turorial site and so far i can see there is nothing wrong but when i run this in the flash 11 debugger with flash builder 4.6 i get only a black screen with nothing in it. I have used the flash away3d 4.1 gold edition
confused

package
{
 import away3d
.containers.View3D;
 
import away3d.controllers.HoverController;
 
import away3d.entities.Mesh;
 
import away3d.materials.ColorMaterial;
 
import away3d.materials.SkyBoxMaterial;
 
import away3d.materials.TextureMaterial;
 
import away3d.primitives.CubeGeometry;
 
import away3d.primitives.PlaneGeometry;
 
import away3d.primitives.SkyBox;
 
import away3d.textures.BitmapCubeTexture;
 
 
import flash.display.ColorCorrection;
 
import flash.display.Sprite;
 
import flash.display3D.textures.Texture;
 
import flash.events.Event;
 
import flash.geom.Vector3D;
 
 
[SWF(width=640height=480frameRate=60)]
 
public class BreakingAway 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;
  private var 
hc:HoverController;
  
  public function 
BreakingAway()
  
{
   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);
   
   
view.camera.= -500;
   
view.camera.300;
   
view.camera.lookAt(new Vector3D());
   
   
hc = new HoverController(view.cameranull15010200);
   
   
addEventListener(Event.ENTER_FRAMEloop);
  
}
  
  
protected function loop(event:Event):void
  {
   hc
.panAngle mouseX 320;
   
hc.tiltAngle mouseY 240;
   
   
view.render();
  
}
 }


apprently everything is correct. But did you try change the camera position ?

   

Wernand, Newbie
Posted: 09 January 2014 11:52 AM   Total Posts: 3   [ # 2 ]

The camera position is correct when i replace the code to use a color material like:

cube = new Mesh(new CubeGeometry(), new ColorMaterial(0xFF0000));// new SkyBoxMaterial(bct)); 

then i get a nice red rotating cube. so pls further help.

confused

   

Wernand, Newbie
Posted: 09 January 2014 12:19 PM   Total Posts: 3   [ # 3 ]

I have found a forum thread with the same problem here: http://away3d.com/forum/viewthread/4962/

Still wondering after reading that thread why it does not work. He said maybe an older version of away3d??

Thanks.

   

Van Hellsing, Newbie
Posted: 10 January 2014 06:30 PM   Total Posts: 30   [ # 4 ]

The quick answer would be SkyBoxMaterial and BitmapCubeTexture are intended for skyboxes ONLY. You should texture your cube with a regular texture instead.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X