Can anyone tell me in simple terms what to change in this pop up code to make
it work?
on (release) {
Movieclip.prototype.openWin1 = function(url, winName, w, h, toolbar,
location, directories, status, menubar, scrollbars, resizable){
getURL("javascript:var myWin1;if (!myWin1 ||
myWin1.closed){myWin1=window.open('"+url+"', '"+winName+"', '"+"width="+w+",
height="+h+", toolbar="+toolbar+", location="+location+",
directories="+directories+", status="+status+", menubar="+menubar+",
scrollbars="+scrollbars+", resizable="+resizable+", top='+0+',
left='+150+'"+"')} else{myWin1.focus();};void(0);"); };
Does window name mean the html code the swf is embedded in needs to have the
title in the int he code
address = "pop1.htm";
winName = "window1";
width = 400;
height = 300;
toolbar = 0;
location = 0;
directories = 0;
status = 0;
menubar = 0;
scrollbars = 0;
resizable = 0;
openWin1(address,winName,width,height,toolbar,location,directories,status,menuba
r,scrollbars,resizable); }
:confused;
David Stiller - 30 Jun 2005 20:48 GMT
dustycoats,
> Can anyone tell me in simple terms what to change in this pop up code
> to make it work?
What you pasted is a lot more than pop up code. For example, what's the
prototype for? Prototyping is a way to add functionality to all instances
of a class, which means that on (release) of this button, suddenly all movie
clips will have a new function called openWin1 ... and I don't think that's
what you're after, is it?
You have to keep in mind, pop ups like the kind you're after are not a
function of Flash. As written, your code invokes JavaScript, which must
find its way to a browser, otherwise nothing will happen (Flash doesn't have
a JavaScript engine; your browser does).
Even the JavaScript you have looks a little more complicated than you
probably want. In fact, you may as well keep the JavaScript where it
belongs naturally, which is in the HTML page itself. You can use getURL()
to invoke the JavaScript function, rather than bundling both languages
(JavaScript and ActionScript) into Flash.
> Does window name mean the html code the swf is embedded in needs to
> have the title in the int he code
The window name is the second parameter of the JavaScript window.open()
method, which -- again, just to be clear -- has nothing to do with Flash.
In JavaScript window.open() accepts three parameters:
A) the name of the file to open
B) a name for this window
C) options, such as show toolbar, statusbar, etc.
As it happens, this method returns a reference to the window it creates,
so you don't even need the second parameter. Just put "" if you like
(instead of "window1"); you simply don't have to name this window. Your
options -- width, height, toolbar, location, etc. -- need to all be quoted
as a single string. It looks as if your code does that ... e.g.,
'"width=500", "height=300", ...', though of course you don't have to nest
your quotes like that ("width=500, height=300, ...").
It will help you greatly to make sure you understand the JavaScript
first. Create a pop up independently in HTML with JavaScript first. Make
sure you understand the JavaScript clearly. When you do, wrap your
window.open() method in a custom function and call that function from
getURL() in ActionScript. It's cleaner that way, and separates the code
where it ought to go.
David
stiller (at) quip (dot) net
"Luck is the residue of good design."
dustycoats - 30 Jun 2005 21:34 GMT
THanks I think I am inover my head.
David Stiller - 30 Jun 2005 21:44 GMT
dustycoats,
> THanks I think I am inover my head.
Happens to everyone at the beginning. :) Start small and build from
there. Again, since you're referencing JavaScript in this case, I
recommend you get the JavaScript working first. That way you'll know the
JavaScript part is solid. Once you have that mastered, study up on the
getURL() function. If they're all mixed together, it's harder to tell which
language is at fault.
David
stiller (at) quip (dot) net
"Luck is the residue of good design."