PDA

View Full Version : in need of simple pop up jpeg from button



peanut
04-05-2007, 07:15 PM
hello, new here, am finishing a simple website. studio mx
I want to click on a button and have a jpeg open in another window the size of the jpeg, clean and simple, I don't know the correct verbage to find help on this in the many books that I have, can someone direct me on how to do the actionscript here?

Johnny Gulag
04-05-2007, 07:57 PM
Here is a tutorial that shows how to do this: http://visualintensity.com/flash-tutorials/mx2004/jswindows/

Hope it helps. :)

peanut
04-06-2007, 06:06 AM
thank you so much for finding me and giving me a response. I have done what is in the tutorial. where do I put the name of the jpeg? replace the word popup with it? I'm not yet getting a window to open after I edited the html page, I messing it up somewhere

Johnny Gulag
04-06-2007, 09:26 AM
The .jpg should be placed on newpage.html using the <img> tag
<img src="" alt="" width="" height="">The only thing you should have to alter in that javascript is the width and height of the new window.

peanut
04-06-2007, 01:56 PM
this is what the tutorial said to do:

<head>
<script language="javascript" type="text/javascript">
function popUp() {

/* begin configuration */
var url = "newpage.html";
var w = "1000";
var h = "374";
var menu = "no";
var scroll = "no";
var tool = "no";
var location = "no";
var resize = "no";
/* end configuration */

<title>cajohnson</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>


where does: <img src="" alt="" width="" height=""> go?

Johnny Gulag
04-06-2007, 03:26 PM
Hello

You need to create a .html file called newpage.html" and add the
<img src="" alt="" width="" height=""> tag to that, use .css to remove the margins and padding from the page by placing the following in the <head></head>:
<style type="text/css">
body, html, img {margin:0;padding:0}
</style>

Then place this JavaScript...
function popUp() {

/* begin configuration */
var url = "newpage.html";
var w = "500";
var h = "300";
var menu = "no";
var scroll = "no";
var tool = "no";
var location = "no";
var resize = "no";
/* end configuration */

var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'width='+w+', height='+h+', top='+wint+', left='+winl+', menubar='+menu+', scrollbars='+scroll+', toolbar='+tool+', location='+location+', resizable='+resize+''
window.open(url, 'popup', winprops);
}...in a new file save it as popup.js (or whatever you want to name it just use a .js extension) in the same folder as the .swf file. Adjust the width and height to match the image dimensions, then add this in the <head></head> of the page with the Flash embedded on it.
<script src="popup.js" type="text/javascript"></script>Hope it helps. If not post again, we will get it sorted :)

Johnny Gulag
04-06-2007, 03:31 PM
Oh, and add this to the button symbol in the flash file:
on (release) {
getURL("javascript:popUp()");
}