How to open up a new windows with size specificed, and etc...

I have created a flash, there are some buttons in the movie, I know I can use flash to open up a new windwos when the button clicked. But how do I make that "just open up" windows in the size that I want it to be? For example, a button from the movie called "About me", and what I want is when I clicked on it, it will pops up a new windows with no location bar, no file menu, no status bar, and have the size of 600X400? Thanks for help !!

P.s. I know it might use javascript to do so, if so how?
LVL 2
clo1Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
kch011099Connect With a Mentor Commented:
Place this in the <head> tags of your html file that contains the main flash file:

<script language="JavaScript">
<!--
function AboutMe() {
window.open('me.html','mainwindow','toolbar=no,status=yes,scrollbars=no,resizable=yes,width=600,height=479')}
// -->
</script>
----------------------------------------

In the flash file, use the following for the action of the button:

Get URL(javascript:AboutMe()")
---------------------------------------

Just copy and paste the Javascript for each button and change the settings. Remember that the function name (i.e. AboutMe) needs to be different for each set if you want different settings.
0
 
SuperMarioCommented:
Try using this in the URL field of the Get URL action:

javascript:open("aboutme.html", "AboutWindow", "scrollbars=no, width=640, height=480, status=no, location=no")

Problem is, you cannot create a java-opened window without first opening a regular browser window (Homey just won't play dat). And, furthermore, Java seems to be the best, if not only way, to manipulate window features.

I hope this helps,

-Dan
0
 
clo1Author Commented:
Please tell me more detail. Like the window option in Flash should be choose _blank, _parent, _top or _bottom?? And I have encountered a problem, when I click on the About me button, it does open a new window fine, but my index page just go blank and have a word "[Object]" on it. What's happen? Please help again. Thanks in advance
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
SuperMarioCommented:
Try selecting _blank in the target field to correct this =)

-D
0
 
clo1Author Commented:
Same, it just leave my index page open, and the about me page is open fine under a new window, but a extra blank page has been opened and written "[Object Window]"..
0
 
SuperMarioCommented:
This is because Flash cannot open a java window without opening a regular browser window first.
0
 
clo1Author Commented:
But I did open a new windows from Flash using the _blank action already. Any other way to make it work?? Please re-post your answer. Thanks !
0
 
AlanGBCommented:
If you use the FS-Command then you can write a java function, in the html of the page on which the movie is placed, to open the window.

Make sure that you set the Publish settings for HTML to use a template that supports FS-Command.

This generates HTML text that has a place holder for the function.  You can create an if block so that you can have multiple functionality, and you can pass arguments so that you can open any page at any size.

Once you've written the java on the page, simply add an action to the button to use the FS-Command and pass the appropriate arguments.
0
 
SuperMarioCommented:
and that would look like this:

FSCommand command name would be "createwnd"

the arguments would be "_blank" or whatever window name you wanna specify...

and then on your button click do this in JS:

if(command == "createwnd") {
open("aboutme.html", args, "width=800, height=600, scrollbars=no");
}

and fill in the rest of the JS info about the window as shown above.

-D
0
 
clo1Author Commented:
Hi guys. Can you guys give me more details on how to do it. Because I have tried several times and still couldn't bring out anything. What I did was:

1) Created a button, and set it  
   propertities's action as:

   On (Release)
      FS Command ("createwnd", "About
      Me")
   End On
   
   published as test.html, and already
   set the html template as "Flash with
   FS command".

2) Added the following statement to
   this test.html page:

   <SCRIPT LANGUAGE=Javascript>
   if(command == "createwnd") {
   open("about.html",
   args, "width=800, height=600,
   scrollbars=no");
   }

Everything seems correct. But when I clicked on the button, it has nothing to happen. Please help me. Thanks !!!

Please send me answer detaily. Thanks again!!


0
 
SuperMarioCommented:
Try open("aboutme.html", "WindowName," "scrollbars=no");

etc
0
 
clo1Author Commented:
It's very confusing right now. Could you please tell me the detail like where to add, and what stuffs like that. Thanks
0
 
AlanGBCommented:
Hi Guys,
try this, taking you right from the beginning (apologies if you know this bit already!)

Go to the file menu and select Publish Settings.
Click the HTML tab in the dialogue box and pull down the Drop down list for Template.
Choose - Flash with FSCommand.
Publish the Movie and then look at the HTML generated - it should look something like this....

<HTML>
<HEAD>
<TITLE>Movie2</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<SCRIPT LANGUAGE=JavaScript>
<!--
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function Movie2_DoFSCommand(command, args) {
  var Movie2Obj = InternetExplorer ? Movie2 : document.Movie2;
  //
  // Place your code here...
  //
}
// Hook for Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
        navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
      document.write('<SCRIPT LANGUAGE=VBScript\> \n');
      document.write('on error resume next \n');
      document.write('Sub Movie2_FSCommand(ByVal command, ByVal args)\n');
      document.write('  call Movie2_DoFSCommand(command, args)\n');
      document.write('end sub\n');
      document.write('</SCRIPT\> \n');
}
//-->
</SCRIPT>
<!-- URL's used in the movie-->
<!-- text used in the movie-->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"
 ID=Movie2 WIDTH=550 HEIGHT=400>
 <PARAM NAME=movie VALUE="Movie2.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="Movie2.swf" quality=high bgcolor=#FFFFFF  WIDTH=550 HEIGHT=400      swLiveConnect=true
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>
</BODY>
</HTML>


Where the code says "place your code here" simply put in the relevant java script.

ie to open another browser window with a URL passed from Flash then do something like this . . .

if (command == "openURL") {
            MyFunction(args);
      }

On the button in the Flash movie use the FS-Command action and type the name of your function in the Command field with the URL in the Argument field.

For multiple functions, simply expand the IF block to allow for each function.

In the header of yur HTML place a function to open the URL in the way you want - for instance . . .

<SCRIPT LANGUAGE=JavaScript>
function MyFunction(page) {
windowprops = "height=160,width=350,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes";
window.open(page, "Popup", windowprops);
}
</SCRIPT>

Note how to turn off/on the various properties of the browser window.

Good luck - and keep me posted!
0
 
clo1Author Commented:
I have found another more easier and better method. Thanks for your help.
0
 
ullaspaCommented:
Hi!

What is that easier & better method??

Regards,

Ullas P.A.
0
All Courses

From novice to tech pro — start learning today.