thanks Ben for your response .

I'm sorry I made a mistake in copying my code I removed a line I had
put bmp.draw (loadedBmp), at first I put the same code as you
suggested me, it 's directly downloaded bitmap

 var loadedBmp : Bitmap = e.target.content as Bitmap;
createPlane(loadedBmp.bitmapData ) ;

Realy i don't understand why .
I think this is the most basic thing in a 3D engine .
NB : it works if i use a MovieMaterial with a Sprite that contains the
same bitmap .





On 12 juin, 09:08, Flchakir <[email protected]> wrote:
> hi guys, I really do not understand why it does not work, I just tried
> to load a jpeg image,   normal size, and from there I created a Plane
> with this BitmapMaterial, then I add the scene, here is my code
> simplified and the error it gives me an error : Bitmap Not valid
>
> private function loadNextPlane() {
>
>                         var loaderContext:LoaderContext = new LoaderContext 
> ();
>                         loaderContext.checkPolicyFile = true;
>
>                         var imageLoader:Loader = new Loader();
>
>                         imageLoader.contentLoaderInfo.addEventListener( 
> Event.COMPLETE,
> imageLoaded );
>                         imageLoader.load( new URLRequest( 
> (this.projectsListData
> [currentIndex] as Project).image ), loaderContext );
>
>                 }
>
>                 function imageLoaded (e : Event ) : void {
>
>                         var loadedBmp : Bitmap = e.target.content as Bitmap;
>
>                         var bmp:BitmapData = new BitmapData(loadedBmp.width,
>                                                         loadedBmp.height,
>                                                                               
>                   true,
>                                                                               
>                   0x00000000
>                                                              );
>
>                         createPlane(bmp);
>
>                 }
>                 public function createPlane(bmp:BitmapData):void{
>                         var plane:Plane = null;
>
>                         var newWidth:Number = 310;
>                         var newHeight:Number = 190;
>                         var planeMaterial:BitmapMaterial = null;
>
>                                 planeMaterial = new BitmapMaterial(bmp);
>                                  planeMaterial.smooth= true;
>
>                                 plane = new Plane( {material :planeMaterial 
> ,width: newWidth,
> height:newHeight,segmentsW:4, segmentsH:4});
>
>                                  plane.x=300;
>
>                           // delete the loaded iamge
>                             bmp.dispose();
>
>                            plane.extra = {planeIndex : 1, height: newHeight};
>                            scene.addChild(plane);
>                            planes.push(plane);
>
>                 }
>
> shame I'm stuck at the beginning, yet I understand away3d through
> every demo, and tutorials
>
> Please help !!!!!

Reply via email to