Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default New Window Sizing

    Hi - -

    I am using the getUrl action to open a new window (_blank) when clicking on a graphic, but I want to be able to control the size and screen position of that new window. Does anyone know if there is an area in Flash's Actionscript where I can add custom code or modify code to do this?

    Thanks for any help!
    John


    sonahawk webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. Sizing of the controls in relation to the browser window
      Hi, When the user opens my program in the browser and the browser window is maximized, the sizing of all the controls such as Accordions,...
    2. Sizing the dataGrid
      I have a dataGrid on a form, In design mode it behaves as I would expect when resizing the form. However when I populate it when running, it no...
    3. ! HELP : sizing my pop-up window : HELP !
      Hey, I am currently making my fourth website, however this is my first all Flash site. I have created my index page as an entry page and the main...
    4. window sizing & close this window code
      Sharon wrote on 16 jul 2003 in microsoft.public.inetserver.asp.general: No ASP to be seen, Sharon, please see a clientside NG, --...
    5. window sizing
      thanks for the tutorial... i'm still having problems. this is starting to drive me insane. ok, the tutorial tells you how to make a new window,...
  3. #2

    Default Re: New Window Sizing

    U can use javascript in the html code page.

    Place it in your head tag

    // Html page code
    //-------------------------------------------------------------------------
    <script language="JavaScript">
    <!--
    var iWin1Width = 1010;
    var iWin1Height = 559;

    function fOpenWin()
    {
    newWin1 = window.open("yourPageName.html","_blank",'toolbar= 0,menubar=0,location=0,directories=0,status=0,scro llbars=0,resizable=0,width=' + iWin1Width + ',height=' + iWin1Height + ',left=0,top=0');

    }
    //-->
    </script>



    Than in your flash file, on your button use this code:

    // Flash code
    //-------------------------------------------------------------------------
    on(release){
    getURL("javascript:fOpenWin();")
    }


    hope that can help u


    Nixy webforumsuser@macromedia.com Guest

  4. #3

    Default Re: New Window Sizing

    Thanks!! I'll try it and let you know.

    John


    sonahawk webforumsuser@macromedia.com Guest

  5. #4

    Default Re: New Window Sizing

    Thanks, the script worked great!

    I want to position the window in the center of the screen for any user. I was able to move the window postion around typing in different numerical values in the "left=0,top=0 part of the code below, but cannot get it to the center of the screen. Is there a way to do this and make it appear in the center for each unique viewer? Thanks again for your help!

    newWin1 = window.open("credits.html","_blank",'toolbar=0,men ubar=0,location=0,directories=0,status=0,scrollbar s=0,resizable=0,width=' + iWin1Width + ',height=' + iWin1Height + ',left=0,top=0');


    sonahawk webforumsuser@macromedia.com Guest

  6. #5

    Default Re: New Window Sizing

    U just have to modify the code a little bit. Like that

    // Html Code
    //---------------------------------------------
    <script language="JavaScript">
    <!--
    var iWin1Width = 1010;
    var iWin1Height = 559;

    var iWin1PosX = (screen.width / 2) - (iWin1Width / 2);
    var iWin1PosY = (screen.height / 2) - (iWin1Height / 2);

    function fOpenWin(btn_lng)
    {
    if(screen.width <= iWin1Width || screen.height <= iWin1Height) {
    newWin1 = window.open("yourPageName.html","_blank",'toolbar= 0,menubar=0,location=0,directories=0,status=0,scro llbars=0,resizable=0,width=' + iWin1Width + ',height=' + iWin1Height + ',left=0,top=0');
    } else {
    newWin1 = window.open("yourPageName.html","_blank",'toolbar= 0,menubar=0,location=0,directories=0,status=0,scro llbars=0,resizable=0,width=' + iWin1Width + ',height=' + iWin1Height + ',left=' + iWin1PosX + ',top=' + iWin1PosY);
    }
    }
    //-->
    </script>

    I use an if statement to verify if the screen is smaller or bigger than the page you want to open. If it's smaller, the new window will be position at 0, 0 elsethe new window will be centered in the screen.

    Hope that can help u


    Nixy webforumsuser@macromedia.com Guest

  7. #6

    Default Re: New Window Sizing

    Thanks so much...that works great!

    Best,
    John


    sonahawk webforumsuser@macromedia.com Guest

  8. #7

    Default Re: New Window Sizing

    Hi - -

    I want the user to be able to scroll down through more info. than the sized window will display. If I want the popup window to have a vertical scroll capability, do I use a "scrollbars" command in the code? If so, where in the code would that be put? I just started teaching myself Javascript and am not sure how to incorporate that function into the code to make it work.

    Thanks,
    John


    sonahawk webforumsuser@macromedia.com Guest

  9. #8

    Default Re: New Window Sizing

    0 = false
    1 = true

    In this part of code, you can set many setting of the new window. In this case all was set to false (0). You can set the scrollbar to true changing the 0 for 1 in the following sentence.

    'toolbar=0,menubar=0,location=0,directories=0,stat us=0,scrollbars=0,resizable=0,width=' + iWin1Width + ',height=' + iWin1Height + ',left=0,top=0'

    example -> scrollbars=1

    hope that can help u


    Nixy webforumsuser@macromedia.com Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139