away3d / away3d-core-openfl

Away3D engine for OpenFL
166 stars 41 forks source link

Backgroundimage of view3d is not displayed ( Flash ) #54

Open ustutz opened 9 years ago

ustutz commented 9 years ago

this is my code: The screen stays black.

It works in the as3 version of away3d.

package; import away3d.containers.View3D; import away3d.textures.BitmapTexture; import flash.display.BitmapData; import flash.events.Event; import flash.Lib;

@:bitmap("lib/floor_diffuse.jpg") class FloorDiffuse extends BitmapData {}

class BackgroundMain {

var view:View3D;

static function main() {
    // Entry point
    new BackgroundMain();
}

public function new() {

    var root = Lib.current;

    view = new View3D();
    root.addChild( view );

    var floorDiffuse = new FloorDiffuse( 0, 0 );

    view.background = new BitmapTexture( floorDiffuse ); //trace( view.background );

    root.addEventListener( Event.ENTER_FRAME, onEnterFrame );
}

function onEnterFrame( e:Event ):Void {
    view.render();
}

}