Pop It Right

[ LiB ] 

Even though this tip has a lot to do with JavaScript, it is one of the most common questions asked of me. "How do I pop up a new window in Flash with no border, buttons, menu, etc...?" Okay, calling JavaScript functions from Flash was discussed earlier in the "Calling All JavaScript!" tip, so now I'll build on that a little. First add the code to call the JavaScript somewhere using this command:

 getURL("javascript:myPopup('http://www.mydomain.com');"); 

Now add this JavaScript code in between the <head> </head> tags in the HTML page that the Flash movie will be placed in.

 <script language="JavaScript" type="text/JavaScript"> <!-- function myPopup(url) {  window.open(url,"newWin","width=500, height=500"); } //--> </script> 

You can change the width and height values in the JavaScript to whatever pixel value you want for your new window. If you need more customized options for the new window, you may want to look into the window.open command in JavaScript, but for the basic pop-up, this is simple and clean. You can also forgo putting JavaScript on the page and just call the window.open function in the getURL instead of calling myPopup.

[ LiB ] 


Macromedia Flash MX 2004 Killer Tips
Macromedia Flash MX 2004 Killer Tips
ISBN: 0735713839
EAN: 2147483647
Year: 2003
Pages: 300
Authors: Shane Elliott

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net