I´ve done exactly what you said João, and I tested to see if the image has been loaded (the log returns the width and height as expected) but it doesn not work! It just does not attach any bitmap...

I´ve tested the same code, but instead of passing the "cont" mc, I passed an attached mc from the library to the draw() method - it worked - it pasted the bitmap from the attached mc.

But with the "cont" mc, which is the mc used by the MovieClipLoader to load the JPEG, it just doesn´t paste the bitmap. If I set the transparent param to false, it just pastes a blank rectangle...

Do you know what could be happening? I´m using MTASC to compile....

Thanks for the help,


Marcelo.

On 6/21/06, Marcelo de Moraes Serpa <[EMAIL PROTECTED]> wrote:
Thanks again for helping João :)

Marcelo.

On 6/21/06, João Saleiro < [EMAIL PROTECTED]> wrote:

Marcelo,  I do not have much time, so here's a copy paste of my code on onLoadInit:

 

                               var bitmap:BitmapData = new BitmapData(foto_holder.img._width, foto_holder.img._height, true);

                               bitmap.draw(foto_holder.img);

                               foto_holder.img.removeMovieClip();

                               foto_holder.img.unloadMovie();

                               foto_holder.img=foto_holder.createEmptyMovieClip("img", foto_holder.getNextHighestDepth());

                               foto_holder.img.attachBitmap(bitmap, foto_holder.img.getNextHighestDepth(),"auto", true);

 

Hope it works for you. Try replacing the null for the nextHighestDepth. And check if the loaded image is available when you run the code: do a trace("image width: " + loaded_img._width), and check if width is not zero.

 

João Saleiro

 

From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Marcelo de Moraes Serpa
Sent: quarta-feira, 21 de Junho de 2006 13:36
To: [email protected]
Subject: [osflash] Using Bitmap data to smooth a image help

 

I have a image loader component which uses the mm loader component to load it´s image. This widget is rotated and scaled, so the image loaded in it gets "pixelated". I was told that (thanks for the tip João Saleiro) I could use the BitmapData class to make a copy of the loader movieclip and attach it again with the smooth flag on. However, I couldn´t get it to work with the loader component, I´ve put the following code at the complete event of the Loader component:

loader_list.complete = Delegate.create(this,function() {

      var bd:BitmapData = new BitmapData(ldr._width,ldr._height,true,1);
      bd.draw(ldr.contentHolder);
      ldr._visible = false;
      this.attachBitmap(bd,null,1);

});

ldr.addEventListener('complete',loader_list);

This code is triggered but it doesn´t copy the loader loaded image (ldr.contentHolder. I´ve also tried ldr and ldr.content ) in the draw() method... maybe becouse at this point it isn´t completely avaiable? Maybe I should use MovieClipLoader and call this code on the onLoadInit event?

Marcelo.


_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org




_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to