Trying to make dynamic images activate javascript on click

Hello everyone-- This place looks like a great resource so I figured I’d sign up and ask. I am modifying an existing Actionscript that creates a basic scrolling thumbnail gallery. The image names and info load dynamically from a PHP doc. So far, the images load fine, the scrolling is tolerable etc… BUT, I am trying to make the thumbnails react to a click and call a javascript function (or do ANYTHING based on the click for that matter…). Any help would be greatly appreciated. I took out some irrelevant code for clarity…


import mx.transitions.Tween;
import mx.transitions.easing.*;
import mx.utils.Delegate;          // used to keep button function scope = main timeline

var lv:LoadVars = new LoadVars();
var pics:Array = [];
var heights:Array = [];
var widths:Array = [];
var mcl:MovieClipLoader;
var ipic:Number;                   // index into pics, used during loading
var ifarleft:Number;               // index of picture currently displayed at far left

function fillPicsArray(ok) {
   if (ok) {
      var i=0;
      do {
         pics.push(this["f"+i]);
		 heights.push(this["h"+i]);
		 widths.push(this["w"+i]);
      } while (this["f"+(++i)] != undefined);
      loadPic();                   // when all read, start first pic loading
   } 
}

function onLoadInit(pic:MovieClip) {
   pic._width = 100;	// width of the viewable image
   pic._height = 80;		// height of the viewable image
   pic._x = 8 + 110*ipic;	// how far to move over? starting x location per photo?
   pic._y = 10;				// starting y location
   pic._alpha = 100;		// transparency
   if (++ipic < pics.length) loadPic();		// load each photo
}
		
function loadPic() {
   holder.createEmptyMovieClip("p"+ipic, ipic);
   holder["p"+ipic]._alpha = 0;
   mcl.loadClip("ximages/s/" + pics[ipic], holder["p"+ipic]);
   
   /* THIS IS WHERE I'M MESSING UP...
   holder["p"+ipic].onRelease = function(){
	getURL("http://www.google.com");
   }
  */
   
}
	

function init() {
   lv.onLoad = fillPicsArray;
   lv.load("readfromdir.php?id=34");
   mcl = new MovieClipLoader();
   mcl.addListener(this);
   ipic = 0;
   this.createEmptyMovieClip("holder", 1);		// holds all loaded pics

}

init();

Thanks a ton!
Dave