Javascript Popup Function in Flash

I"m trying to write a fucntion in flash to launch a javascript popup window but can’t seem to get the variables in right. Here is the code.

Button Code
[AS]on (release) {
_root.popup(pic1,436,356);
}[/AS]

Function in the first frame of the root
[AS]function popup(number,picwidth,pichieght){
getURL(“javascript:var mypopup = window.open(‘gallery/’+number+’.htm’,‘mySite’,‘toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=‘picwidth’,height=‘pichieght’,top=’+eval((screen.availHeight - ‘pichieght’) / 3)+’,left=’+eval((screen.availWidth - ‘picwidth’) / 2));mypopup.focus();”);
}[/AS]

Any ideas?

I have done something like this before. What I did was used JavaScript in the external page :slight_smile:

Something like this…

<SCRIPT LANGUAGE="JavaScript">
<!--
function resize(w, h){
 	var imgW = document.galleryImage.width;
	var imgH = document.galleryImage.height;	
	var centerWidth = (screen.width) ? (screen.width-imgW)/2 : 0;
	var centerHeight = (screen.height) ? (screen.height-imgH)/2 : 0;
	window.resizeTo(imgW, imgH);
	window.moveTo(centerWidth, centerHeight);
}
-->
</SCRIPT>

That would be your function, and it would be called onLoad of the page…

<BODY ONLOAD="resize()">

And the image would have to be named “galleryImage” (unless changed in the script)…

<IMG SRC="image.jpg" NAME="galleryImage">

Now of course if you have seperate pages for each image, that will be hassle to add into each page. And that is why for mine I put it in a PHP page, sent the URL to the image via a query string and pull that info in to load the image…

<?
$img = $_GET["img"];
list($width, $height, $type, $attr) = getimagesize($img);
echo "<img src=\"$img\" NAME=\"galleryImage\" $attr>";
?>

Oh yeah, and note the javascript code repositions the window, I did this because when I used it the window was centered, and changing the window size after it is already centered makes it not so centered.