hi guys, i am trying to make this xml gallery that dynamically resizes according to the picture’s width & height. the function resizer() is hardcoded with fix values. i have tried to assign it from the array like below but it works wierd, the border just keep increasing in size.
menuHolder["but"+i].onRelease = function() {
                imageLoader.loadClip(this.path,gallery.imageHolder);
                gallery.imageBorder.tween("_width",this.width,1,"easeOutExpo");
                gallery.imageBorder.tween("_height",this.height,1,"easeOutExpo");
                gallery.imageBackground.tween("_width",this.width,1,"easeOutExpo");
                gallery.imageBackground.tween("_height",this.height,1,"easeOutExpo");
                
            };
AS:
#include "lmc_tween.as"
var galleryXML:XML = new XML();
galleryXML.ignoreWhite = true;
galleryXML.onLoad = loadXML;
function loadXML(ok) {
    if (ok) {
        var path:Array = new Array();
        var thumbs:Array = new Array();
        var width:Array = new Array();
        var height:Array = new Array();
        var sec:Array = new Array();
        var color:Array = new Array();
        xmlNode = this.firstChild;
        total = xmlNode.childNodes.length;
        for (i=0; i<total; i++) {
            path.push(xmlNode.childNodes*.attributes.path);
            thumbs.push(xmlNode.childNodes*.attributes.thumbs);
            width.push(xmlNode.childNodes*.attributes.width);
            height.push(xmlNode.childNodes*.attributes.height);
            sec.push(xmlNode.childNodes*.attributes.sec);
            color.push(xmlNode.childNodes*.attributes.color);
            menuHolder.attachMovie("button","but"+i,i);
            menuHolder["but"+i]._x = menuHolder["but"+i]._width*i;
            menuHolder["but"+i].path = path*;
            menuHolder["but"+i].width = width*;
            menuHolder["but"+i].height = height*;
            menuHolder["but"+i].sec = sec*;
            menuHolder["but"+i].color = color*;
            menuHolder["but"+i].thumbs = thumbs*;
            menuHolder["but"+i].thumbHolder.loadMovie(thumbs*);
            
            menuHolder["but"+i].onRelease = function() {
                imageLoader.loadClip(this.path,gallery.imageHolder);
                resizer();
            };
        }
        imageLoader.loadClip(path[0],gallery.imageHolder);
    } else {
        trace("ERROR LOADIN XML");
    }
}
galleryXML.load("gallery.xml");
function resizer() {
    gallery.imageBorder.tween("_width",520,1,"easeOutExpo");
    gallery.imageBorder.tween("_height",520,1,"easeOutExpo");
    gallery.imageBackground.tween("_width",500,1,"easeOutExpo");
    gallery.imageBackground.tween("_height",500,1,"easeOutExpo");
    background.colorTo(0x336699,1);
    gallery.imageHolder.brightnessTo(100,0);
    gallery.imageHolder.alphaTo(0,0);
}
onEnterFrame = function(){;
gallery.imageHolder._x = Math.floor(-gallery.imageBorder._width/2+10);
gallery.imageHolder._y = Math.floor(-gallery.imageBorder._height/2+10);
gallery.ploader._x = Math.floor(gallery.imageBorder._x);
gallery.ploader._y = Math.floor(gallery.imageBorder.y);
};
var imageLoader:MovieClipLoader = new MovieClipLoader();
var imageLoaderListener:Object = new Object();
imageLoaderListener.onLoadProgress = function() {
gallery.ploader.alphaTo(100,1);
};
imageLoaderListener.onLoadComplete = function() {
gallery.imageHolder.brightnessTo(0,1,"",1);
gallery.imageHolder.alphaTo(100,1,"",1);
gallery.ploader.alphaTo(0,1);
};
imageLoader.addListener(imageLoaderListener);
///////////////////////////////////
Stage.scaleMode = "noScale";
Stage.align = "TL";
sizeListener = new Object();
sizeListener.onResize = function() {
background._width = Stage.width;
background._height = Stage.height;
gradient._width = Stage.width;
gradient._height = Stage.height;
gallery.x = Stage.width/2;
gallery.y = Stage.height/2;
};
Stage.addListener(sizeListener);
background._width = Stage.width;
background._height = Stage.height;
gradient._width = Stage.width;
gradient._height = Stage.height;
gallery.x = Stage.width/2;
gallery.y = Stage.height/2;
XML:
<?xml version="1.0" encoding="UTF-8"?>
<gallery>
    
    <picture path="images/img1.jpg" thumbs="thumbs/thumb1.jpg" width="500" height ="500" sec="1" color="#336699"></picture>
    <picture path="images/img2.jpg" thumbs="thumbs/thumb2.jpg" width="400" height ="350" sec="1" color="#336699"></picture>
    <picture path="images/img3.jpg" thumbs="thumbs/thumb3.jpg" width="600" height ="200" sec="1" color="#336699"></picture>
    <picture path="images/img4.jpg" thumbs="thumbs/thumb4.jpg" width="600" height ="200" sec="1" color="#336699"></picture>
        
        
</gallery>
example of the file: http://www.jiajin88.com/demo/xmlgallery/index.html