Antonatwork
asked on
creating a (flash) html popop using existing code
In a site I am working on a javascript is used to create fixed sized popup's. I would like to use the same script to create fixed sized popup's from within a flash file.
The Code that is used in the HTML is the folowing.
--------
<script language="JavaScript" type="text/JavaScript">
<!--
var win=null;
function NewWindowScroll(mypage,myn ame,w,h,po s,infocus) {
if(pos=="random"){myleft=( screen.wid th)?Math.f loor(Math. random()*( screen.wid th-w)):100 ;mytop=(sc reen.heigh t)?Math.fl oor(Math.r andom()*(( screen.hei ght-h)-75) ):100;}
if(pos=="center"){myleft=( screen.wid th)?(scree n.width-w) /2:100;myt op=(screen .height)?( screen.hei ght-h)/2:1 00;}
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop= 20}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location= no,directo ries=no,st atus=no,me nubar=no,t oolbar=no, resizable= yes";
win=window.open(mypage,"po pup",setti ngs);
win.focus();
}
function NewWindow(mypage,myname,w, h,pos,info cus){
if(pos=="random"){myleft=( screen.wid th)?Math.f loor(Math. random()*( screen.wid th-w)):100 ;mytop=(sc reen.heigh t)?Math.fl oor(Math.r andom()*(( screen.hei ght-h)-75) ):100;}
if(pos=="center"){myleft=( screen.wid th)?(scree n.width-w) /2:100;myt op=(screen .height)?( screen.hei ght-h)/2:1 00;}
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop= 20}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=n o,director ies=no,sta tus=no,men ubar=no,to olbar=no,r esizable=n o";
win=window.open(mypage,"po pup",setti ngs);
win.focus();
}
//-->
</script>
---------
The HTML link that uses this script looks like this
---------
<a href="javascript:NewWindow Scroll('li nk.html',' ','400','3 00','cente r','front' );">link<b r/></a>
---------
I want to use the same script in a flash button to launch a new window with a fixed size.
Can anyone help me out with this one line of code.
Thanks a lot,
Anton
The Code that is used in the HTML is the folowing.
--------
<script language="JavaScript" type="text/JavaScript">
<!--
var win=null;
function NewWindowScroll(mypage,myn
if(pos=="random"){myleft=(
if(pos=="center"){myleft=(
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=
win=window.open(mypage,"po
win.focus();
}
function NewWindow(mypage,myname,w,
if(pos=="random"){myleft=(
if(pos=="center"){myleft=(
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=n
win=window.open(mypage,"po
win.focus();
}
//-->
</script>
---------
The HTML link that uses this script looks like this
---------
<a href="javascript:NewWindow
---------
I want to use the same script in a flash button to launch a new window with a fixed size.
Can anyone help me out with this one line of code.
Thanks a lot,
Anton
ASKER
I did not reall know how to combine the get URL thing and the Javascript.
The anwser you have given me does not contain an URL. I have tried the following.
on(release) {
getURL("http://www.test.com/test.html","javascript:NewW indowScrol l('link.ht ml','','40 0',300','c enter','fr ont')");
}
But i does not work.
I just get a new screen, but nothing special like a fixed size or a 400 x 300 resolution.
Is there something wrong with my code?
The anwser you have given me does not contain an URL. I have tried the following.
on(release) {
getURL("http://www.test.com/test.html","javascript:NewW
}
But i does not work.
I just get a new screen, but nothing special like a fixed size or a 400 x 300 resolution.
Is there something wrong with my code?
ASKER
No this is also not helpfull. This get URL really has to work together with the javascript mentioned in the first post.
I have no access to the index file, so I cannot change the javascript
I have no access to the index file, so I cannot change the javascript
Is the flash movie embedded in the same page where the javascript function is defined?
ASKER
yes
Here are two that I have used...
http://www.actionscript.org/tutorials/beginner/spawn_browser/index.shtml
http://www.actionscript.org/tutorials/beginner/PopUp_window_within_flash/index.shtml
I hope this helps
Ciao -
Coma12
http://www.actionscript.org/tutorials/beginner/spawn_browser/index.shtml
http://www.actionscript.org/tutorials/beginner/PopUp_window_within_flash/index.shtml
I hope this helps
Ciao -
Coma12
Anton,
try the following~
getURL("javascript:NewWind owScroll(' http://www.test.com/test.html','','400','300','center','front')");
Vicker
try the following~
getURL("javascript:NewWind
Vicker
Anton:
Don't know if you've figured this out yet, but an easy solution might be as follows:
Include the fscommand code in the HTML page that includes the Flash file.
From Flash, use:
fscommand("myFunction","my Link");
In the Javascript then, within the function declared as:
function myFile_DoFSCommand(command , args)
If it's not already there, add:
var myArgs = new String(args);
var cmd = new String(command);
Then, a simple if statement:
if (cmd == "myFunction") {
NewWindowScroll(myArgs,'', '400',300' ,'center', 'front');
}
args can also be an array, if you want to send more than one parameter.
Hope this helps, this question has been idle for a while.
David Crossman
-=-
Don't know if you've figured this out yet, but an easy solution might be as follows:
Include the fscommand code in the HTML page that includes the Flash file.
From Flash, use:
fscommand("myFunction","my
In the Javascript then, within the function declared as:
function myFile_DoFSCommand(command
If it's not already there, add:
var myArgs = new String(args);
var cmd = new String(command);
Then, a simple if statement:
if (cmd == "myFunction") {
NewWindowScroll(myArgs,'',
}
args can also be an array, if you want to send more than one parameter.
Hope this helps, this question has been idle for a while.
David Crossman
-=-
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
on(release) {
getURL("javascript:NewWind
}