Blank Black Screen

Software: Away3D 4.x

zvone, Newbie
Posted: 15 October 2011 02:36 PM   Total Posts: 7

Hello, I have compiled AnimatedBitmapMaterialTest succesfully, but when browser window pop-ups I get blank black screen, any ideas why?

This is code I use:

package
{
 import away3d
.containers.*;
 
import away3d.lights.DirectionalLight;
 
import away3d.lights.LightBase;
 
import away3d.lights.PointLight;
 
import away3d.materials.AnimatedBitmapMaterial;
 
import away3d.materials.BitmapMaterial;
 
import away3d.primitives.Cube;
 
import away3d.primitives.Plane;
 
import away3d.containers.ObjectContainer3D;
 
 
import flash.display.BitmapData;
 
import flash.display.Sprite;
 
import flash.display.MovieClip;
 
import flash.display.StageAlign;
 
import flash.display.StageScaleMode;
 
import flash.events.Event;
 
import flash.utils.getTimer;
 
 
import flash.filters.DisplacementMapFilter;
 
import flash.filters.BlurFilter;
 
import flash.geom.Point;

 
[SWF(width="800"height="600"frameRate="60"backgroundColor="#000000")
 
 
public class AnimatedBitmapMaterialTest extends Sprite
 {
  
private var _view View3D;
  private var 
_ctr ObjectContainer3D;
  private var 
_light PointLight;
  private var 
_seaAnim:AnimatedBitmapMaterial;
   
  
[Embed(source="assets/models/textures/sea.jpg")]
  
private var SeaImage : Class;
  
  
[Embed(source="assets/models/textures/sea_NRM.png")]
  
private var SeaImageNRM : Class;
   
  public function 
AnimatedBitmapMaterialTest()
  
{
   addEventListener
(Event.ADDED_TO_STAGEinit);
  
}

  
private function init(e:Event):void
  {
   initView
();
   
initObjects();
   
this.addEventListener(Event.ENTER_FRAME_handleEnterFrame);
  
}
  
  
private function initView():void
  {
   _view 
= new View3D();
   
   
this.addChild(_view);
   
_view.camera.50;
   
_view.camera.100;
   
_view.camera.= -800;
    
   
_light = new PointLight();
   
_light.= -1000;
   
_light.1000;
   
_light.= -1000;
   
_light.radius 400;
   
_light.fallOff 800;
   
_light.color 0x66FFFFF;
 
   
_view.scene.addChild(_light);
   
   
stage.scaleMode StageScaleMode.NO_SCALE;
   
stage.align StageAlign.TOP_LEFT;
   
stage.addEventListener(Event.RESIZEonStageResize);
        
}
  
  
private function initObjects():void
  {
   
var waterBmd:BitmapData = new SeaImage().bitmapData;
   var 
maps:Array = generateSequence(waterBmd64);
   
   var 
waterNMBmd:BitmapData = new SeaImageNRM().bitmapData;
   var 
normalMaps:Array = generateSequence(waterNMBmd64);

   
//in this example we do not pass a movieClip, we generate a series of bitmapdata via code
   // and use the setFrames method instead.
   //Replace the null by a movieclip with 1 or more frames if you want to generate from an animation stored in a movieclip
   // call then would be: _seaAnim = new AnimatedBitmapMaterial(myMc, true, false, 0);
   
   
_seaAnim = new AnimatedBitmapMaterial(nulltruefalse0waterBmd);
   
_seaAnim.setMaps(maps);
   
_seaAnim.setNormalMaps(normalMaps);
   
_seaAnim.play();
   
_seaAnim.lights [_light];
    
   
_ctr = new ObjectContainer3D();
   var 
plane:Plane = new Plane(_seaAnim100010001010);
   
_ctr.addChild(plane);
   var 
plane2:Plane = new Plane(_seaAnim100010001010);
   
plane2.rotationY 180;
   
_ctr.addChild(plane2);
   
   var 
cube:Cube = new Cube();
   
cube.material _seaAnim;
   
cube.+= 50;
   
_ctr.addChild(cube);
   
_view.scene.addChild(_ctr);
  
}
  
  
private function generateSequence(sourceWater:BitmapDatacopies:int 1):Array
  
{
   
var watersources:Array = [];
   var 
frames:Array = [];
 
   var 
dubWater:BitmapData sourceWater.clone();
   var 
perlinmap:BitmapData sourceWater.clone();
   var 
dmf:DisplacementMapFilter = new DisplacementMapFilter(perlinmap, new Point(00), 1188"wrap");
   var 
bf:BlurFilter = new BlurFilter(4,4);
   var 
pt1:Point = new Point(0,0);
   var 
pt2:Point = new Point(0,0);
   var 
ptzero:Point = new Point(0,0);
   var 
perlinOffsets:Array = [pt1pt2];
   
   var 
frame:BitmapData;
   for(var 
i:uint 0i<copies; ++i){
    sourceWater
.copyPixels(dubWater,dubWater.rect,ptzero);
    
perlinOffsets[0].+= 8;
    
perlinOffsets[1].+= 2;
     
    
perlinmap.perlinNoise(2563222truefalse2trueperlinOffsets);
    
dmf.mapBitmap perlinmap;

    
sourceWater.applyFilter(sourceWatersourceWater.rect,ptzero,dmf);
    
sourceWater.applyFilter(sourceWatersourceWater.rect,ptzero,bf);
    
sourceWater.draw(sourceWater,null,null,"hardlight",sourceWater.rect,true);
    
frame sourceWater.clone();
    
watersources.push(frame);
   
}
   
   watersources 
watersources.concat(frames.reverse());
   
dubWater.dispose();
   
perlinmap.dispose();
   
dmf null;
   
   return 
watersources;
  
}

  
private function onStageResize(event Event) : void
  {
   _view
.width stage.stageWidth;
   
_view.height stage.stageHeight;
  
}
  
  
private function _handleEnterFrame(ev Event) : void
  {
   _ctr
.rotationY += 1;
   
_view.render();
  
}
 }
   

Richard Olsson, Administrator
Posted: 15 October 2011 03:29 PM   Total Posts: 1192   [ # 1 ]

It sounds like you are using the old broomstick examples (and not the new ones in the away3d-examples-fp11 repository). Chances are you’re getting some runtime error, but you’re not seeing it because you are not running in debug mode. Please make sure you have the latest Away3D version (from the away3d-core-fp11 github repository), the latest examples (from the away3d-examples-fp11 repository) and that you have the debug version of Flash Player 11 installed and running.

   

zvone, Newbie
Posted: 15 October 2011 04:24 PM   Total Posts: 7   [ # 2 ]

Well there are only 3 examples @ https://github.com/away3d/away3d-examples-fp11/tree/master/src

Is that it?

Okay, used core and examples from the github and I compiled AnimatedBitmapMaterialTest, got this error after installing content debugger,

ErrorError #2032: Stream Error. URL: assets/PolarBear.awd
 
at away3d.library::AssetLibrary/onDependencyRetrievingError()[C:\Users\Marin\Desktop\AS3\away3d-away3d-core-fp11-0ab3ebe\src\away3d\library\AssetLibrary.as:568]
 at flash
.events::EventDispatcher/dispatchEventFunction()
 
at flash.events::EventDispatcher/dispatchEvent()
 
at away3d.loaders::AssetLoader/onRetrievalFailed()[C:\Users\Marin\Desktop\AS3\away3d-away3d-core-fp11-0ab3ebe\src\away3d\loaders\AssetLoader.as:296]
 at flash
.events::EventDispatcher/dispatchEventFunction()
 
at flash.events::EventDispatcher/dispatchEvent()
 
at away3d.loaders.misc::SingleFileLoader/handleUrlLoaderError()[C:\Users\Marin\Desktop\AS3\away3d-away3d-core-fp11-0ab3ebe\src\away3d\loaders\misc\SingleFileLoader.as:236]
 at flash
.events::EventDispatcher/dispatchEventFunction()
 
at flash.events::EventDispatcher/dispatchEvent()
 
at flash.net::URLLoader/onComplete() 


Good thing is that now I can see debug info and Away3d logo, after I dismissed all the errors I could see background, but no polar bear.

   

Richard Olsson, Administrator
Posted: 15 October 2011 11:37 PM   Total Posts: 1192   [ # 3 ]

As the error sates, it is trying to load the polar bear from a folder alled assets, which needs to be relative to the SWF. Make sure you put the assets folder in whatever folder that your IDE outputs the swf into.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X