Misalignment of JPG using Tutorial of Centered Popup Window

Hi guys, this is my first post here. These forums have been a great read the past week :slight_smile:

I have done a search and haven’t found an answer, so I thought I’d ask here.

I used the tutorial on this site to create a centered popup window, and it works! However, when I try to use a ā€œ*.jpgā€ extension so that the window just displays a picture I have, it misaligns the picture so that there is a white border on the left and top of the picture. This doesn’t happen when I enter a destination that is an HTML file.

Does anyone know how I can fix this? I don’t have to create an HTML file for every JPG I have, which just has code to embed a picture in it, do I? That would be a lot of files!

Thanks in advance,

Chito

hi, welcome!
you probably are going to have to make a page for each photo. I just don’t think you have the same amount of control over formatting with .jpg, like you would have with a .html extension.
If you knew a serverside language you could code just one page, and load all the photos into that, but that would require a host that supported a servide language like php or asp (etc).

*also I wouldn’t really consider this a ā€˜flash’ question, you probably would have gotten better results from posting this in the ā€˜client side’ forum

Pass the file name as a query string and use one single html to pick up the correct file to load.

Thanks for the replies :slight_smile: I’m sorry… what type of questions goes into the ā€œclient sideā€ forums?

Should I repost this question there? Because I really have no clue what Claudio just suggested I do :frowning: I dont’ know how to pass a query string.

Thanks,

Chito

Replace the prototype on your fla for this one:

Movieclip.prototype.openWinCentre = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
	getURL("java****script:var myWin; if(!myWin || myWin.closed){myWin = window.open('popup.html?"+url+"','"+winName+"','"+"width="+w+",height="+h+",toolbar="+toolbar+",location="+location+",directories="+directories+",status="+status+",menubar="+menubar+",scrollbars="+scrollbars+",resizable="+resizable+",top='+((screen.height/2)-("+h/2+"))+',left='+((screen.width/2)-("+w/2+"))+'"+"')}else{myWin.focus();};void(0);");
};

Now save the following piece of code with the name popup.html. Place it in the same folder as your swf.

<html>
<head>
<title>
</title>
</head>
<body>
<script language="javascript">
document.write("<img src='"+location.search.slice(1,location.search.length)+"'>");
</script>
</body>
</html>

Welcome :slight_smile: