Strange problem with AS2 and XML

Hey guys,

long time since i posted in these forums :z: hehe
i need your help as i don’t know what the hell could be going wrong here. I’m creating a function with which, when clicked, an enlarged image would pop up.

Here’s the code:

ShowImage = function(pic) {
	_root.onEnterFrame = function(){
		var t = _root.PicContainer.getBytesTotal(), l = _root.PicContainer.getBytesLoaded();
		if (t != 0 && (l/t) == 1){
			_root.PicContainer._x = Math.round((Stage.width/2)-(_root.PicContainer._width/2));
			_root.PicContainer._y = Math.round((Stage.height/2)-(_root.PicContainer._height/2));
			_root.PopUpClose._x = Math.round((Stage.width/2)-(_root.PicContainer._width/2));
			_root.PopUpClose._y = Math.round((Stage.height/2)-(_root.PicContainer._height/2));
			
			trace(_root.PicContainer._width + ", " + _root.PicContainer._height);
			
			_root.PopUpBackground._visible = true;
			_root.PicContainer._visible = true;
			_root.PopUpClose._visible = true;
			delete _root.onEnterFrame;
			t=0;
			l=0;
		}
	}
	_root.PopUpBackground._x = Math.round(Stage.width/2);
	_root.PopUpBackground._y = Math.round(Stage.height/2);
	_root.PopUpBackground._width = Stage.width;
	_root.PopUpBackground._height = Stage.height;
	_root.PicContainer.loadMovie(pic);
};

the code i use for the button in anotner Flash is simple:

btn.onRelease = function(){
	_level0.ShowImage("Gallery/Image_big.jpg");
}

the image pops in in the center and everything is fine and dandy

but when i try to use the code in XML in the text using:

<![CDATA[<p><a href="asfunction:_level0.ShowImage,Gallery/Image_big.jpg">Link1</a></p>]]></caption>

the pic comes appears nicely but does not center!.

Variables _root.PicContainer._width and _root.PicContainer._height remain 0, and next time a link is clicked these variables pull in the info from the last picture, which again does not center the image :frowning:

what am i missing here? do i have to add something in the if code?

please help me :crying: