Hi i currently have a xml loaded image gallery http://amyrossportfolio.comoj.com/advertising.html created in flash. The issue i am having is when an image is loaded it always appears on the left handside attached to the top left point of the stage. Is there anyway i can get these images to load in the centre of the stage? This is the AS that is attached to my flash document.


Actionscript Code:
function initGallery()
{
    function loadXML(loaded)
    {
        if (loaded)
        {
            xmlNode = this.firstChild;
            total = xmlNode.childNodes.length;
            for (i = 0; i < total; i++)
            {
                _root.small_image[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
                _root.big_image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
                _root.description[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
                if (i == 0)
                {
                    _root.loadGImage(_root.description[i], _root.big_image[i]);
                } // end if
                ++_root.total_images;
            } // end of for
            createSmall();
            _root.downloadButton._visible = true;
        }
        else
        {
            content = "file not loaded!";
        } // end else if
    } // End of the function
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    if (_root.xml_file == undefined)
    {
        _root.xml_file = "images1.xml";
    } // end if
    xmlData.load(xml_file);
} // End of the function
function createSmall()
{
    _root.smallContainer.createEmptyMovieClip("smallImageContainer", 10);
    var _loc4 = 0;
    var _loc3 = 0;
    for (var _loc2 = 0; _loc2 < _root.small_image.length; ++_loc2)
    {
        _root.smallContainer.imageContainer.attachMovie("smallImage", "smallImage_" + _loc2, 100 + _loc2);
        m = _root.smallContainer.imageContainer["smallImage_" + _loc2];
        m._x = _loc3 * 50;
        m._y = 0;
        m.imageContainer.loadMovie(_root.small_image[_loc2], 100);
        m.iData = Array();
        m.iData.big = _root.big_image[_loc2];
        m.iData.title = _root.description[_loc2];
        ++_loc3;
    } // end of for
    _root.smallImageContainer._x = 5;
    _root.smallImageContainer._y = 0;
} // End of the function
function loadGImage(title, bigImgURL)
{
    _root.bigImage.imageContainer.loadMovie(bigImgURL, 100);
    _root.bigImage.imageContainer._x = Stage.width.bigImage.imageContainer_width/2;
    _root.bigImage.imageContainer._y = Stage.height.bigImage.imageContainer._height/2;
    _root.title.text = title;
    _root.downloadButton.onRelease = function ()
    {
        getURL(bigImgURL, "_blank");
    };
} // End of the function
function goFullScreen()
{
    Stage.displayState = "fullScreen";
} // End of the function
function exitFullScreen()
{
    Stage.displayState = "normal";
} // End of the function
function menuHandler(obj, menuObj)
{
    if (Stage.displayState == "normal")
    {
        menuObj.customItems[0].enabled = true;
        menuObj.customItems[1].enabled = false;
    }
    else
    {
        menuObj.customItems[0].enabled = false;
        menuObj.customItems[1].enabled = true;
    } // end else if
} // End of the function
_root.description = new Array();
_root.small_image = new Array();
_root.big_image = new Array();
_root.total_images = 0;
initGallery();
var fullscreenCM = new ContextMenu(menuHandler);
fullscreenCM.hideBuiltInItems();
var fs = new ContextMenuItem("Go Full Screen", goFullScreen);
fullscreenCM.customItems.push(fs);
var xfs = new ContextMenuItem("Exit Full Screen", exitFullScreen);
fullscreenCM.customItems.push(xfs);
_root.menu = fullscreenCM;
downloadButton._visible = false

I have heard the below code may work

Actionscript Code:
_root.createEmptyMovieClip("imagecontainer", _root.imagecontainer.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadInit = function(mc:MovieClip) {//is now loaded and initialized in flash,- ready to center
mc._x = Stage.width/2 - mc._width/2;
mc._y = Stage.height/2 - mc._height/2;
}
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("image18.jpg", imagecontainer

I have no idea where to implement this in my code though

thanks very much

Lee