Button pops up HTML

Hi guys,

I’m having trouble creating some kind of code/actionscript to add to a button, which will make a HTML window pop-up with a picture inside. If possible, the window should close again if the picture is clicked…

Anyone have any ideas how I should do this?

I tried a couple of K’s tuts but they didn’t work :frowning:

Cheers

yes you can do it with Flash + JavaScript

#1 . on(release) of flash btn call a javascript Function.
eg. on(release){
getURL(“javaScript:openPopup()”)

#2. In javascript function open the new window
function openPopup(){
var newWin = window.open(“file Name”,“new name”, “features”)
}
#3. on Click of Image call a function that close the window
window.close()

Please feel free to ask if u have further doubt

regards
Ajo.K.jose

Thanks already, but I still don’t quite get it…

What would be the code in full to put on the button itself?

I know it’s:

on(release){
getURL(“javascript:openPopup()”)
But where inside that code does

function openPopup(){
var newWin = window.open(“file Name”,“new name”, “features”)
}

go?
And what should I put for “features”?

:ne:

features refers to open window features ; find here full code

<script language=“JavaScript”>
function openPopup(){
var newWindow = windo.open(“popup.html”,“myWindow”,"height=200 width=100 scrollbar=0 menubar=0 statusbar=0 ")
}
</script>

Okay, thanks a lot mate :party:

Cheers :beer:

El - Does it work?

If you want I could give you a tutorial right now on how to open the window and close when the picture is clicked :).

  1. On the button, have this code - Do not edit target winName:
on (release) {
	address = "http://www.kirupa.com/modular/pop-up.htm";
	target_winName = "kirupa";
	width = 400;
	height = 300;
	toolbar = 0;
	location = 0;
	directories = 0;
	status = 0;
	menubar = 0;
	scrollbars = 1;
	resizable = 0;
	openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
}
  1. On the frame of that button, have this code:
_global.openWinCentre = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
        getURL("javascript:window.open('"+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+"))+'"+"');void(0);");
};
  1. Create your HTML page that will popup and use an img tag to insert the picture and what not. I think the picture should be aligned at the very top left of it, or either in the middle. I dont know, try stuff out.

  2. Make sure you image img tags are like this:

<img src="URL" width="BLAH" height="BLAH" onclick="window.close();">

:).

Okay, thanks Sharif :thumb:

:wink: :wink:

No problem :).