Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

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,myname,w,h,pos,infocus){
        if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
        if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
        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,directories=no,status=no,menubar=no,toolbar=no,resizable=yes";
        win=window.open(mypage,"popup",settings);
        win.focus();
}

function NewWindow(mypage,myname,w,h,pos,infocus){
        if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
        if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
        else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
        settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";
        win=window.open(mypage,"popup",settings);
        win.focus();
}
//-->
</script>
---------

The HTML link that uses this script looks like this
---------
<a href="javascript:NewWindowScroll('link.html','','400','300','center','front');">link<br/></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
0
Antonatwork
Asked:
Antonatwork
1 Solution
 
sokhodomCommented:
Have you tried getURL?

on(release) {
getURL("javascript:NewWindowScroll('link.html','','400','300','center','front')");
}
0
 
AntonatworkAuthor Commented:
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:NewWindowScroll('link.html','','400',300','center','front')");
}

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?



0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
AntonatworkAuthor Commented:
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

0
 
negatyveCommented:
Is the flash movie embedded in the same page where the javascript function is defined?
0
 
AntonatworkAuthor Commented:
yes
0
 
vickerleungCommented:
Anton,

try the following~

getURL("javascript:NewWindowScroll('http://www.test.com/test.html','','400','300','center','front')");

Vicker
0
 
DavidCrossmanCommented:
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","myLink");

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
-=-



0
 
DarthModCommented:
PAQed with no points refunded (of 500)

DarthMod
Community Support Moderator
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now