[osflash] Using Bitmap data to smooth a image help

João Saleiro joao.saleiro at webfuel.pt
Wed Jun 21 22:38:04 EDT 2006


Are you loading images from external domains? BitmapData doesn’t work with
loaded images from domains different than the one where your swf resides.
This is a security issue. 

Is this your problem? If not, I do not have a clue on what it could be,
since I never had similar problems with it.  K

 

More info:
http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhel
p.htm?context=LiveDocs_Parts
<http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhe
lp.htm?context=LiveDocs_Parts&file=00001950.html> &file=00001950.html

João Saleiro

 

From: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org] On
Behalf Of Marcelo de Moraes Serpa
Sent: quinta-feira, 22 de Junho de 2006 3:28
To: Open Source Flash Mailing List
Subject: Re: [osflash] Using Bitmap data to smooth a image help

 

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 <celoserpa at gmail.com> wrote:

Thanks again for helping João :) 

Marcelo.

On 6/21/06, João Saleiro < joao.saleiro at webfuel.pt
<mailto:joao.saleiro at webfuel.pt> > 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: osflash-bounces at osflash.org [mailto:
<mailto:osflash-bounces at osflash.org>  osflash-bounces at osflash.org] On Behalf
Of Marcelo de Moraes Serpa
Sent: quarta-feira, 21 de Junho de 2006 13:36
To: osflash at osflash.org
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
osflash at osflash.org
http://osflash.org/mailman/listinfo/osflash_osflash.org



 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20060622/ff8d0c16/attachment-0001.htm


More information about the osflash mailing list