-
Smoothing bitmap dynamically loaded through xml
Hi there,
Trying to set the smoothing of a dynamically loaded, through XML, JPEG set to true using AS2.
I've seen an example of that would do this with this code:
createEmptyMovieClip("myMC",getNextHighestDepth()) ;
loadBitmapSmoothed("mypic.jpg",myMC);
in my code I'm loading a series of products from an XML file. Each bit of information for each product gets loaded into a seprate array...
I have a 'zoomy box' image, which loads an image, but at 200%, which I want to smooth...
so the code =
nZoompic1[i] = (childs.childNodes[EEE].childNodes[i].childNodes[18].firstChild.nodeValue);
Any ideas what the syntax would be for getting it to work?
-
Read this:
http://help.adobe.com/en_US/AS2LCR/F...=00000786.html
That's where you use smoothing, setting that param to true:
public draw(source: Object, [matrix: Matrix], [colorTransform: ColorTransform], [blendMode: Object], [clipRect: Rectangle], [smooth: Boolean]) : Void
gparis
-
I think I've phrased my question wrongly... its more like this that I'm after...
http://board.flashkit.com/board/showthread.php?t=757794
-
I understand what you're after and that is the method you want. I used draw() a couple of years ago on a photographer's website where (loaded) jpgs get resized dramatically. Same issue, they won't look good when not smoothed.
gparis
-
Here's how (fully commented):
PHP Code:
import flash.display.BitmapData; import flash.geom.Matrix; function myCopy(pic) {
// create mc to draw to var mc = this.createEmptyMovieClip('mc', this.getNextHighestDepth()); // bitmap info var bmp = new flash.display.BitmapData(loadListener.myWidth, loadListener.myHeight, true, 0xFFFFFF); // draw image to canvas bmp.draw(pic); this.picparent.container.attachBitmap(bmp,0,null,true); //just to test add a slight rotation - comment out this.picparent._rotation = -10; }
// create the movieclips // first the temporary mc where you load the initial image this.createEmptyMovieClip('temploader', this.getNextHighestDepth()); // then a movieclip where you'll create your canvas this.createEmptyMovieClip('picparent', this.getNextHighestDepth()); // finally the actual movieclip where your image will get drawn picparent.createEmptyMovieClip('container', this.getNextHighestDepth());
var loadListener:Object = new Object(); var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
loadListener.onLoadStart = function(target_mc:MovieClip):Void { // make the temporay mc invisible target_mc._alpha=0; } loadListener.onLoadInit = function(target_mc:MovieClip):Void { // get the image dimensions this.myWidth = target_mc._width; this.myHeight = target_mc._height; // when the image is fully loaded copy it with smoothing to the final container myCopy(temploader); }; function preload(myClip) { //loding fumction mcLoader.loadClip(myClip,temploader); }
//Start loading your image preload("mj.png");
Paste this into an empty .fla. Just update your picture's name at the end.
gparis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|