# Adding Thumbnails kirupa gallery with smoothing?

**URL:** https://forum.kirupa.com/t/adding-thumbnails-kirupa-gallery-with-smoothing/240255
**Category:** flash
**Created:** [October 1, 2007, 12:50pm UTC](https://forum.kirupa.com/t/adding-thumbnails-kirupa-gallery-with-smoothing/240255 "2007-10-01T12:50:43Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![drivebass](https://avatars.discourse-cdn.com/v4/letter/d/cc9497/32.png) [@drivebass](https://forum.kirupa.com/u/drivebass)
#### Post date: [October 1, 2007, 12:50pm UTC](https://forum.kirupa.com/t/adding-thumbnails-kirupa-gallery-with-smoothing/240255/1 "2007-10-01T12:50:43Z")

</div>

Hello there.  
I;m not that much experienced in Actionscript.  
I made a xml gallery using kirupa’s xml gallery tutorial and then i added thumbnails.  
It all works fine. But i have one big problem.  
Although i managed to have the jpg’s loaded fullscreen i dont know how to use smoothing  
for the resize of the movieclip container. I have a code that resizes the movieclip to the dimensions of the stage onresize function. But when it gets resized it’s not smoothing  
and the jpg looks bad.  
I’m trying to put in the code an attachBitmap function so i can have it with smoothing to true. But i haven’t managed how yet. Tried to place the function everywhere but no hope.  
Does someone knows hoe to do this.

Here is the code for the gallery:  
[SIZE=1]function loadXML(loaded) {[/SIZE]  
[SIZE=1]if (loaded) {[/SIZE]  
[SIZE=1]xmlNode = this.firstChild;[/SIZE]  
[SIZE=1]image = [];[/SIZE]  
[SIZE=1]description = [];[/SIZE]  
[SIZE=1]thumbnails = [];[/SIZE]  
[SIZE=1]total = xmlNode.childNodes.length;[/SIZE]  
[SIZE=1]for (i=0; i\<total; i++) {[/SIZE]  
[SIZE=1]image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;[/SIZE]  
[SIZE=1]description\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;[/SIZE]  
[SIZE=1]thumbnails\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;[/SIZE]  
[SIZE=1]thumbnails\_fn(i);[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]firstImage();[/SIZE]  
[SIZE=1]} else {[/SIZE]  
[SIZE=1]content = “file not loaded!”;[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]xmlData = new XML();[/SIZE]  
[SIZE=1]xmlData.ignoreWhite = true;[/SIZE]  
[SIZE=1]xmlData.onLoad = loadXML;[/SIZE]  
[SIZE=1]xmlData.load(“images.xml”);[/SIZE]  
[SIZE=1]/////////////////////////////////////[/SIZE]  
[SIZE=1]function thumbnails\_fn(k) {[/SIZE]  
[SIZE=1]\_root.logop.thumbnail\_mc.createEmptyMovieClip(“t”+k, \_root.logop.thumbnail\_mc.getNextHighestDepth());[/SIZE]  
[SIZE=1]tlistener = new Object();[/SIZE]  
[SIZE=1]tlistener.onLoadInit = function(target\_mc) {[/SIZE]  
[SIZE=1]target\_mc.\_x = (target\_mc.\_width)_k;[/SIZE]  
[SIZE=1]target\_mc.pictureValue = k;[/SIZE]  
[SIZE=1]target\_mc.alphaTo(50,0.5,“easeOutBounce”);[/SIZE]  
[SIZE=1]target\_mc.onRelease = function() {[/SIZE]  
[SIZE=1]p = this.pictureValue-1;[/SIZE]  
[SIZE=1]nextImage();[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]target\_mc.onRollOver = function() {[/SIZE]  
[SIZE=1]this.alphaTo(100,0.5,“easeOutBounce”);[/SIZE]  
[SIZE=1]thumbNailScroller();[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]target\_mc.onRollOut = function() {[/SIZE]  
[SIZE=1]this.alphaTo(50,0.5,“easeOutBounce”);[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]\_root.logop.image\_mcl = new MovieClipLoader();[/SIZE]  
[SIZE=1]\_root.logop.image\_mcl.addListener(tlistener);[/SIZE]  
[SIZE=1]\_root.logop.image\_mcl.loadClip(thumbnails[k], "root.logop.thumbnail\_mc.t"+k);[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]listen = new Object();[/SIZE]  
[SIZE=1]listen.onKeyDown = function() {[/SIZE]  
[SIZE=1]if (Key.getCode() == Key.LEFT) {[/SIZE]  
[SIZE=1]prevImage();[/SIZE]  
[SIZE=1]} [/SIZE]  
[SIZE=1]if (Key.getCode() == Key.RIGHT) {[/SIZE]  
[SIZE=1]nextImage();[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]Key.addListener(listen);[/SIZE]  
[SIZE=1]// PREVIOUS BUTTON ACTIONS[/SIZE]  
[SIZE=1]previous\_btn.onRelease = function() {[/SIZE]  
[SIZE=1]prevImage();[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]// NEXT BUTTON ACTIONS[/SIZE]  
[SIZE=1]next\_btn.onRelease = function() {[/SIZE]  
[SIZE=1]nextImage();[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]/////////////////////////////////////[/SIZE]  
[SIZE=1]p = 0;[/SIZE]  
[SIZE=1][COLOR=red]root.IMG\_MC.\_alpha = 0;[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]function loadIt() {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]this.onEnterFrame = function() {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.IMG\_MC.alphaTo(0,0.5,“linear”);[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]if (\_root.IMG\_MC.\_alpha\<1 ) {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.IMG\_MC.loadMovie(image[p], 1);[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]this.onEnterFrame = function() {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]filesize = \_root.IMG\_MC.getBytesTotal();[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]loaded = \_root.IMG\_MC.getBytesLoaded();[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.preloader.alphaTo(100,0.1,“linear”);[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.preloader.xScaleTo(100,0.1,“linear”);[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]percent = 100_(loaded/filesize);[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]if (loaded != filesize) {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.preloader.bar.\_xscale = percent;[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.preloader.percent\_txt.text = int(percent)+"%";[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]} else {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.preloader.alphaTo(0,1.5,“linear”);[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.preloader.xScaleTo(0,1.5,“easeOutBounce”);[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]if (\_root.IMG\_MC.\_alpha\<100) {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.IMG\_MC.alphaTo(100,1,“linear”,0) [/COLOR][/SIZE]  
[SIZE=1][COLOR=red]if (\_root.IMG\_MC.\_alpha\>99) {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.IMG\_MC.\_alpha = 100;[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]delete this.onEnterFrame;[/COLOR][/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]function nextImage() {[/SIZE]  
[SIZE=1]if (p\<(total-1)) {[/SIZE]  
[SIZE=1]p++;[/SIZE]  
[SIZE=1]if (loaded == filesize) {[/SIZE]  
[SIZE=1]loadIt();[/SIZE]  
[SIZE=1]desc\_txt.text = description[p];[/SIZE]  
[SIZE=1]picture\_num();[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]function prevImage() {[/SIZE]  
[SIZE=1]if (p\>0) {[/SIZE]  
[SIZE=1]p–;[/SIZE]  
[SIZE=1]loadIt();[/SIZE]  
[SIZE=1]desc\_txt.text = description[p];[/SIZE]  
[SIZE=1]picture\_num();[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1][COLOR=red]function firstImage() {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]if (loaded == filesize) {[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]\_root.IMG\_MC.loadMovie(image[0], 1);[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]loadIt();[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]desc\_txt.text = description[0];[/COLOR][/SIZE]  
[SIZE=1][COLOR=red]picture\_num();[/COLOR][/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]function picture\_num() {[/SIZE]  
[SIZE=1]current\_pos = p+1;[/SIZE]  
[SIZE=1]pos\_txt.text = current\_pos+" / "+total;[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]function thumbNailScroller() {[/SIZE]  
[SIZE=1]// thumbnail code! [/SIZE]  
[SIZE=1]this.createEmptyMovieClip(“tscroller”, 1000);[/SIZE]  
[SIZE=1]scroll\_speed = 10;[/SIZE]  
[SIZE=1]\_root.logop.tscroller.onEnterFrame = function() {[/SIZE]  
[SIZE=1]if ((\_root.\_ymouse\>=\_root.logop.thumbnail\_mc.\_y) && (\_root.\_ymouse\<=\_root.logop.thumbnail\_mc.\_y+\_root.logop.thumbnail\_mc.\_height)) {[/SIZE]  
[SIZE=1]if ((\_root.\_xmouse\>=(\_root.logop.hit\_right.\_x-40)) && (\_root.logop.thumbnail\_mc.hitTest(hit\_right))) {[/SIZE]  
[SIZE=1]\_root.logop.thumbnail\_mc.\_x -= scroll\_speed;[/SIZE]  
[SIZE=1]} else if ((\_root.\_xmouse\<=(\_root.logop.hit\_left.\_x+40)) && (\_root.logop.thumbnail\_mc.hitTest(hit\_left))) {[/SIZE]  
[SIZE=1]\_root.logop.thumbnail\_mc.\_x += scroll\_speed;[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]} else {[/SIZE]  
[SIZE=1]delete \_root.logop.tscroller.onEnterFrame;[/SIZE]  
[SIZE=1]}[/SIZE]  
[SIZE=1]};[/SIZE]  
[SIZE=1]}[/SIZE]

and the code i thought it could work for the smoothing under load.Movie:

[SIZE=1]myBitmap = new BitmapData(\_root.IMG\_MC.\_width, \_root.IMG\_MC.\_height, true, 0xFFFFFF);[/SIZE]  
[SIZE=1]myBitmap.draw(\_root.IMG\_MC);[/SIZE]  
[SIZE=1]removeMovieClip(\_root.IMG\_MC);[/SIZE]  
[SIZE=1]createEmptyMovieClip("\_root.IMG\_MC", getNextHighestDepth());[/SIZE]  
[SIZE=1]\_root.IMG\_MC.attachBitmap(myBitmap,1,“auto”,true);[/SIZE]

[SIZE=1][SIZE=2][/SIZE][/SIZE]  
[SIZE=1][SIZE=2]ANY HELP PLEASE???!![/SIZE][/SIZE]  
IN Red is every loading procedure of the code.

thank you!  
[SIZE=1][SIZE=2][/SIZE][/SIZE]  
[SIZE=1][SIZE=2][/SIZE]  
[/SIZE]
