A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: centre screen pop-up

  1. #1
    Junior Member
    Join Date
    Oct 2002
    Posts
    12

    centre screen pop-up

    Now I've worked out how to get the pop-up window to work i now want the pop-up to appear centre screen as apposed to the top left the code on the button is below but what do i need to alter to achieve this.

    on (release) { getURL("javascript:window.open('image1.html','imag e1','width=500,height=500,top=0,left=0,toolbar=no, scrollbars=yes,resizable=no,menubar=no,status=yes, directories=no,location=no'); void(0);");
    }

  2. #2
    Product Designer keyone.it's Avatar
    Join Date
    Aug 2001
    Location
    Rome, Italy.
    Posts
    1,625
    before the void() action you should add something like this...but I can't remember exactly the window dimension variables:
    Code:
    moveTo(screen.width/2-window.width/2,screen.height/2-window.height/2);
    By the way, IE and NN work in a different way, and produce different results, you should make a dispatcher and develop a code for each system, including Mac support....
    Altruism does not exist. Sustainability must be made profitable.

  3. #3
    Senior Member nepdude's Avatar
    Join Date
    Feb 2001
    Location
    Canada
    Posts
    960
    insert this script into the head section of your html

    <*script language="javascript">
    function a(){
    var leff = (screen.width - 600) / 2
    var topp = (screen.height - 300) / 2
    window.open('image1.html','one','left=' + leff + ' top= ' + topp + ' width=600 height=300')
    }
    <*/script>

    then for the geturl action use this

    on (release) {
    getURL("javascript:a()");
    }
    nObOdY dIeS A vIrGiN,
    LIfE sCrEwS uS aLL

  4. #4
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Here's a version from catbert that worked first time, and I had never done one before. In the head of the html page that holds the main movie, add:

    Code:
    <*script type="text/javascript">
    <*!--
    function openWindow(url,name,w,h) {
    xPos = (screen.width - w) / 2;
    yPos = (screen.height - h) / 2;
    config = 'left=' + xPos + ',screenX=' + xPos + ',top=' + yPos + ',screenY=' + yPos + ',width=' + w + ',height=' + h; 
    newWindow = window.open(url, name, config);
    }
    //-->
    </script>
    In the button to open the popup, add:

    Code:
    on (release) {
    	getURL("javascript:*openWindow('popup.html','newWin',600,500);");
    }
    The popup window size is set here. Whatever size it is now, it will open center screen. You can change the size on the button, and the java on the main page will still center it.

    add; the forum doesn't like my code, so remove the *'s above when you copy.
    Last edited by iaskwhy; 12-15-2002 at 04:03 PM.

  5. #5
    Junior Member
    Join Date
    Oct 2002
    Posts
    12
    Thanks all for the advice but is there anyway i can accomplish the centre screen pop-up without having to add anything to the html file and do it all directly from within flash as i did with the pop-up.

    Cheers
    Mark

    Sunderland 2 Liverpool 1 Fantastic!!

  6. #6
    Really this is me..... mentaleruptions's Avatar
    Join Date
    Apr 2002
    Location
    WV, USA
    Posts
    1,114
    Originally posted by markm73
    Thanks all for the advice but is there anyway i can accomplish the centre screen pop-up without having to add anything to the html file and do it all directly from within flash as i did with the pop-up.

    Cheers
    Mark

    Sunderland 2 Liverpool 1 Fantastic!!
    You could try this but you will need the macromedi extension manager to use it:

    PopUp Component
    Extension Manager

    Hope this can help you.
    Mental

    My Flashkit Submited Movies:
    Guestbook: V.1.0 V.1.2 V.1.3 V.1.4 PHP Mail Form: V.1.0
    My Deviantart page: Link

  7. #7
    Junior Member
    Join Date
    Apr 2009
    Posts
    12
    Quote Originally Posted by Ask The Geezer View Post
    Here's a version from catbert that worked first time, and I had never done one before. In the head of the html page that holds the main movie, add:

    Code:
    <*script type="text/javascript">
    <*!--
    function openWindow(url,name,w,h) {
    xPos = (screen.width - w) / 2;
    yPos = (screen.height - h) / 2;
    config = 'left=' + xPos + ',screenX=' + xPos + ',top=' + yPos + ',screenY=' + yPos + ',width=' + w + ',height=' + h; 
    newWindow = window.open(url, name, config);
    }
    //-->
    </script>
    In the button to open the popup, add:

    Code:
    on (release) {
    	getURL("javascript:*openWindow('popup.html','newWin',600,500);");
    }
    The popup window size is set here. Whatever size it is now, it will open center screen. You can change the size on the button, and the java on the main page will still center it.

    add; the forum doesn't like my code, so remove the *'s above when you copy.
    Re. the Catbert solution provided by Ask The Geeza: I can't seem to get this to work.

    Please confirm that the following code goes between the <script></script> tags:

    <*!--
    function openWindow(url,name,w,h) {
    xPos = (screen.width - w) / 2;
    yPos = (screen.height - h) / 2;
    config = 'left=' + xPos + ',screenX=' + xPos + ',top=' + yPos + ',screenY=' + yPos + ',width=' + w + ',height=' + h;
    newWindow = window.open(url, name, config);
    }
    //-->

    Grateful if you could clarify which elements of the code I need to customise and with what information?

    Many thanks.

    Rich

  8. #8
    Junior Member
    Join Date
    Apr 2009
    Posts
    12
    To clarify: I currently have this script on the button in the Flash movie:

    on (press) {
    getURL("javascript:NewWindow=window.open('comp_pop-up.html','newWin','width=520,height=808,left=20,to p=20,\toolbar=No,location=no,scrollbars=yes,status =no,resizable=yes,fullscreen=no'); NewWindow.focus();\r void(0);");
    }

    Only thing wrong with this is that it doesn't x and y centre the pop-up window.

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