Dynamic Masking for XML Driven Photo Gallery

I am creating a photo gallery using xml and a thumbnail bar at the side. I want each picture to fit into a square without distorting the image, so I will need to use masks. Currently I am using the loadClip metohd for loading pictures then I am attempting to use onLoadInit to dynamically set the masks. It is hard to show the problem on here so I have here’s the link…

http://misolad.vndv.com/xml_gallery.zip

It seems that you can’t place “i” values in the onLoadInit part which I tired previously, atm I can only get one to work as you will be able to see.

Cheers