XML gallery question

Hi all,
I’m designing my web site for my portfolio using the XML gallery described in the tutorials section.

I’m trying to improve the gallery to :

  • center the picture in the dedicated zone
  • display a black frame around the picture.

Here is the code :

function loadImage(index:Number)
{
picture._alpha = 0;
picture.loadMovie(image[index], 1);
cadre._width = picture._width + 20;
cadre._height = picture._height + 20;
picture._x = CENTER_X - (picture._width / 2);
picture._y = CENTER_Y - (picture._height / 2);
cadre._x = picture._x - 10;
cadre._y = picture._y - 10;
}

picture id the movie clip described in the tutorial
cadre is an empty black movie clip to make the frame around the picture

I get the following problems :

  • for the first image only, the width and height are 0
  • the frame is displayed over the picture, even if picture is in a dedicated layer over the one containing the frame

I don’t know how to solve these problems, so any help would be greatly appreciated.