Hello,
I've found a possible bug in TransfromBitmapMaterial.
When the color is applied before the bitmap loads, bitmap doesn't
show.
In the example below the bitmap data, load by bitmaploader class, is
given to the constructor of TransformBitmapMaterial...
var bitmapURL = "bitmap.jpg"
var bd:BitmapData = new BitmapData(600,600,false,0xFFFFFF);
var bitmap:Bitmap = new Bitmap(bd, "auto", true);
var loader:BitmapLoader = new BitmapLoader(bitmap);
var urlRequest:URLRequest= new URLRequest(bitmapURL);
if (matVO.urlDiffuse)
{
loader.load(urlRequest);
}
material = new TransformBitmapMaterial(bd, {repeat: true, smooth:
true});
material.color = matVO.color;
// CLASS BITMAP LOADER /////////////////////////
public class BitmapLoader extends Loader
{
public var bitmap:Bitmap = new Bitmap();
public function BitmapLoader(bitmap:Bitmap)
{
super();
this.bitmap = bitmap;
this.contentLoaderInfo.addEventListener(Event.COMPLETE,
loadCompleteHandler);
}
private function loadCompleteHandler(event:Event):void
{
var content:Bitmap = event.target.content;
var matrix:Matrix = new Matrix();
var sw:Number = 600 / content.width;
var sh:Number = 600 / content.height;
matrix.scale(sw,sh);
bitmap.bitmapData.draw(content,matrix);
}
}