A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: javascript opening a new window

  1. #1
    Senior Member zoranvedek's Avatar
    Join Date
    Aug 2001
    Location
    Wagoner OK
    Posts
    893
    I can open a new window and size it using javascript............



    Is there a way that I can have multiple scripts in the html header, each with a different height and width, being called from different buttons?

    For instance:

    Button #1 will call a script and open a new window 300x400

    Button #2 will call another script that opens a new window of 100x400

    Perhaps if I assigned a variable to the newWindow command and called that instead? If so what would be the basics of setting it up? I'm really having much more trouble with it than I should be.

    Thanks in advance,

    -Jason

  2. #2
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    Hi Jason,

    I should think that this is possible. I would use the FlashCommand inside your movie to access the underlying HTML.

    Have a look at this thread where this topic was covered. I've got a link in there to an example that I put together. You can use the same example to call various routines in your HTML. For what you want to do I'd setup a variable in the movie and give it a value that corresponds to the function that you want to use in HTML. Then in your HTML you can use a switch statement to call the appropriate function.

    http://board.flashkit.com/board/show...hreadid=305179

    I hope this helps and is what you're looking for.

    Cheers,
    Ed

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    fscommand

    Originally posted by zoranvedek
    I can open a new window and size it using javascript............



    Is there a way that I can have multiple scripts in the html header, each with a different height and width, being called from different buttons?

    For instance:

    Button #1 will call a script and open a new window 300x400

    Button #2 will call another script that opens a new window of 100x400

    Perhaps if I assigned a variable to the newWindow command and called that instead? If so what would be the basics of setting it up? I'm really having much more trouble with it than I should be.

    Thanks in advance,

    -Jason
    I have had zero luck getting FScommand to work, as far as I'm concerned it's broke.. However to answer your question YES and easily In your openwindow function have a variable for each of these and pass them in the javascript call.

    Example
    this javascript opens a window and when you call it in your 3dfa button just use javascript:mapWindow(windowname,http://thepagetoload,height,width);

    [code]
    <script language="JavaScript">
    <!--
    function mapWindow(winName,url,h,w)
    {

    var the_features="width="+ w + " ,height=" +h+ " scrollbars";
    winName=window.open(url,'MAPS',the_features);
    var height=window.screen.availHeight;
    var width=window.screen.availWidth;
    //Calc left
    var left_point=parseInt(width/2)-parseInt(w/2);
    //Calc top
    var top_point=parseInt(height/2)-parseInt(h/2);
    the_window.moveTo(left_point, top_point);
    //Show me -->
    }
    // -->
    </script>

  4. #4
    Senior Member zoranvedek's Avatar
    Join Date
    Aug 2001
    Location
    Wagoner OK
    Posts
    893
    Bret,

    I think this is exactly what I need..........

    I'll try it later and let you know.


    -Jason

  5. #5
    Senior Member kusco's Avatar
    Join Date
    Nov 2001
    Posts
    681
    Hi Bret and Jason,

    I should have mentioned also to view the source of the HTML of the example. It has all the code you need to get the FSCommand to work (which is the same as Flash Command in 3DFA).

    In the HTML source I've added comments to help explain what is happening and what is needed. I've also used the GetVariable() and SetVariable() properties to show how you can retrieve and set the variables in a movie.

    There's also a little VBScript in the HTML source which I've found is 100% required otherwise it won't work. This could be where the problems lay for you Bret??

    Also, the FSCommand only works with client side scripting.

    I'd like to be able to help you get the FSCommand to work as it can be very useful. eg. you can access cookies on the client from your movie and use this across different loaded movies and pages.

    Bret, let me know how you go (if you do that is).

    Cheers,
    Ed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center