And John, your apporach seems very flexible too, I will try that in another situation :)
Cheers!
Marcelo.
I'm working on a similar application, but to apply some blur to the pixelated image, I just created a blur filter and applied it to the filters array of the movieclip that the image is loaded into - no BitmapData required:
import flash.filters.BlurFilter;
var blur:BlurFilter = new BlurFilter(1.5, 1.5, 3);
mc.filters = [blur];
hth,
JGOn 6/21/06, João Saleiro <[EMAIL PROTECTED]> wrote: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
João Saleiro
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Marcelo de Moraes Serpa
Sent: quinta-feira, 22 de Junho de 2006 3:28
To: Open Source Flash Mailing ListSubject: 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 <[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
--
John Grden - Blitz
_______________________________________________
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
