Check the example in the docs.
You need to create a copy of the original (loaded) image, add it to the display
list and remove the (original) loaded image
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Bitmap.html
Here's an example of loading an image and displaying a copy next to it:
import flash.display.Loader;
import flash.net.URLRequest;
import flash.display.Bitmap;
var loader:Loader;
var req:URLRequest;
var orig_mc:MovieClip;
var copy_mc:MovieClip;
function loaderCompleteHandler(evt:Event) {
var ldr:Loader = evt.currentTarget.loader as Loader;
var origImg:Bitmap = (ldr.content as Bitmap)
origImg.width = 200;
origImg.height = 150;
var image:Bitmap = new Bitmap(origImg.bitmapData, "auto", true);
image.width = 200;
image.height = 150;
copy_mc.addChild(image);
}
loader = new Loader();
req = new URLRequest("2.jpg");
loader.load(req);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
loaderCompleteHandler);
orig_mc = new MovieClip();
orig_mc.addChild(loader);
addChild(orig_mc);
copy_mc = new MovieClip();
copy_mc.x = 210;
addChild(copy_mc);
regards,
Muzak
----- Original Message -----
From: "Irene Johansson" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, February 03, 2008 7:43 PM
Subject: [Flashcoders] Dynamic upload of bunch of images with automaticsmooth.
Hello all you fine people!
I have a big problem with uploading smooth images.
What I do is, i load XML file, parse it loop through it, create movieclips,
and load images into thos movieclips (if image is specified in xml)
for(var k:Number=1; k<=itemNr; k++){
usrNr++;
var walker1:MovieClip = new walker();
walker1.x = k*150+ Math.random()*40;
//walker1.y = Math.random()*5;
walker1.name = "walker"+k;
walker1.i = i;
walker1.k = k;
this["row"+i].addChild(walker1);
var walkerMc:MovieClip = this["rad"+i].getChildByName("walker"+k) as
MovieClip;
if(xml..epic[usrNr-1].text()!= undefined){
//upload picture
var loader:Loader = new Loader();
walkerMc.figure.head.imgholder.addChild(loader);
loader.load(new URLRequest(theURL+"img/"+xml..epic[usrNr-1].text()));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleComplete,
false, 0, true);
}else{
//show random face
walkerMc.figure.head.faces.gotoAndStop(xml..spic[brukerNr-1].text());
}
}
function handleComplete(event:Event){
var ldr:Loader = LoaderInfo(event.currentTarget).loader as Loader;
ldr.contentLoaderInfo.content.width=43;
ldr.contentLoaderInfo.content.height=43;
var image:Bitmap = Bitmap(ldr.contentLoaderInfo.content);
image.smoothing = true;
}
I get to load images, but they are not allways smooth :(
What am i doing wrong :(
Thanks in advance
Irene
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders