Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash&Javascript 1

Status
Not open for further replies.

Ivan1

Programmer
Jun 18, 2001
113
US
I've posted a similar question before, but did not get the answer I wal looking for.
Here is what I'm trying to do.
I have an HTML page that has a link to a Flash page which contains a 700x400 movie.
When I press the button on HTML page I would like my Flash open in a centered 700x400 window (SO THE MOVIE FITS IN PERFECTLY) with borders, minimize option, close option, BUT no resize option. No toolbar either. Very plain looking window.

PLEASE help me out with the script.
 
if u still want script:

<script>
function openin(){
var winX, winY
if ( document.all ){winX=document.body.clientWidth; winY=document.body.clientHeight}
else{winX=window.innerWidth; winY=window.innerHeight}
neededWidth=700
neededHeight=400
neededX=(screen.width-neededWidth)/2
neededY=(screen.height-neededHeight)/2
prefs='left='+neededX+', top='+neededY+', width='+neededWidth+', height='+neededHeight+', resizable=no, toolbars=0'
wnd=window.open('myfile.html','',prefs)
}
</script>
<body bgcolor=&quot;#FFFFFF&quot; onload='openin()'>

but, unfortunetly, i culdnt turn off resize option for now ... :(( may be someone else here wuld say how 2 do it - i'm interested too.

regards, vic
 
oops!
event - whatever u like (if u want - onclick on some button/picture/layer)

& i think

neededX=(screen.availWidth-neededW)/2
neededY=(screen.availHeight-neededH)/2

wuld be better

c ya
 
This script does not seem to work.
Or maybe I'm doing something wrong.
Where do I paste this script? Between what tags? On what page - the one I'm trying to open in a new window or the original page with the button?

Thanks
 
Hi Ivan1,
Try this. I took this from a basic html page created with Macromedia Dreamweaver 4... just changed the function name to help with readability.

The color red in the example below denotes the url/filename that you'd need to change to reflect your Flash movie.

Hope that helps...

- Eric
----------------

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script language=&quot;JavaScript&quot;>
<!--
function OpenFlashWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<a href=&quot;#&quot; onclick=&quot;OpenFlashWindow('movie.swf','flashwindow','toolbar=yes,location=yes,status=yes,menubar=yes,width=700,height=400')&quot;>open</a>
</body>
</html>
 
Works perfect, Eric.
I've been looking for an answer to this question for about a week.
Thank you so much.
If you don't mind me asking. How do you automaticaly center the new pop-up window?
 
hi Ivan,
to center it, like i wrote before, use this function (ar just add green code 2 Eric's function):
from the main page:


<html>
<head>
<title>open centered</title>
</head>
<script>
function openin(){
neededW=700
neededH=400

neededX=(screen.availWidth-neededW)/2
neededY=(screen.availHeight-neededH)/2

prefs='left='+neededX+', top='+neededY+', width='+neededW+', height='+neededH+', resizable=no, toolbar=no'
wnd=open('movie.swf','',prefs)
}
</script>
<body bgcolor=&quot;#FFFFFF&quot; >
<a href=&quot;javascript:void(0)&quot; onclick=&quot;openin()&quot;>open centered window</a>
</body>
</html>

have no idea why that function didnt work for'ya..

regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top