A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: pop up window in the screen CENTER

  1. #1
    Member
    Join Date
    Oct 2005
    Posts
    31

    pop up window in the screen CENTER

    Hi,

    How to add screenX and screenY in below actionscript to make the pop up window in the screen CENTER.


    function myFunction() {

    getURL("javascript:NewWindow=window.open('URL','ne wWin','width=350,height=300,left=0,top=0,toolbar=n o,location=no,scrollbars=no,status=no,resizable=no ,fullscreen=no');NewWindow.focus();void(0);")
    }

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Code:
    openLink = function(param,name,w,h,a,b,c,d,e,f,g){
    sUrl = param;
    resx = System.capabilities.screenResolutionX;
    resy = System.capabilities.screenResolutionY;
    lft = resx/2 - w/2;
    tp = resy/2 - h/2;
    
    getURL("javascript:window.open('"+sUrl+"','"+name+
    "','width="+w+",height="+h+",top="+tp+",left="+lft+
    ",directories="+a+",location="+b+",menubar="+c+
    ",resizable="+d+",status="+e+",toolbar="+f+
    ",scrollbars="+g+"');void(0);");
    };
    
    popUpBtn.onPress = function(){
    openLink("portfolio.html","portfolio",300,200,"no","no","no","yes","no","no","no");
    };

  3. #3
    Member
    Join Date
    Oct 2005
    Posts
    31
    thank dog, i download the file "geturl" to read it, but my script is already set, can you teach me mix below:

    var my_lv = new LoadVars();
    my_lv.onLoad = function() {
    trace(this.myLink);
    my_link.htmlText = this.myLink;
    };
    my_lv.load("link.txt");

    function myFunction() {

    getURL("javascript:NewWindow=window.open('http://hk.movies.yahoo.com','newWin','width=350,height=30 0,left=0,top=0,toolbar=no,location=no,scrollbars=n o,status=no,resizable=no,fullscreen=no');NewWindow .focus(); void(0);")
    }

    ______________________

    the link.txt is " &myLink=<a href="asfunction:myFunction">yahoo movies</a> "
    ______________________

    the "getURL" is link "link.txt", that inside is movies link list, that mean no any "on release/press" something action in the flash file

  4. #4
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    Nice Script doggy !!

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    Code:
    var my_lv = new LoadVars();
    my_lv.onLoad = function() {
    trace(this.myLink);
    my_link.htmlText = this.myLink;
    };
    my_lv.load("link.txt");
    
    function myFunction() {
    sUrl = "http://hk.movies.yahoo.com";
    name = "newWin";
    w=350; h= 300;
    a ="no"; b ="no"; c ="no"; d ="no"; e ="no"; f ="no"; g ="no"; 
    resx = System.capabilities.screenResolutionX;
    resy = System.capabilities.screenResolutionY;
    lft = resx/2 - w/2;
    tp = resy/2 - h/2;
    getURL("javascript:window.open('"+sUrl+"','"+name+
    "','width="+w+",height="+h+",top="+tp+",left="+lft+
    ",directories="+a+",location="+b+",menubar="+c+
    ",resizable="+d+",status="+e+",toolbar="+f+
    ",scrollbars="+g+"');void(0);");
    };
    this hack will work
    to make it re-usable, change the text file to -
    Code:
    &myLink=<a href="asfunction:myFunction,http://hk.movies.yahoo.com">yahoo movies</a>
    and go to the function with -
    Code:
    function myFunction(param) {
    sUrl = param;
    ...snip
    ...snip
    };

  6. #6
    Senior Member
    Join Date
    Mar 2001
    Posts
    536
    Dog, I'm having some trouble with your script.
    I uploaded my file. do you know what I did wrong?

    Thanks

    http://www.mouseexplorer.com/test/popwindow.zip

  7. #7
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    what trouble specifically ??
    syntax errors ??
    failing to open the window when testing offline ??
    (you must upload the html and swf to a server and test online)

  8. #8
    Senior Member
    Join Date
    Mar 2001
    Posts
    536
    sorry for not giving enough detail.

    failing to open the window when testing offline

  9. #9
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    failing to open the window when testing offline

    caused by new security rules for the Flash Player
    you must upload and test online

  10. #10
    Senior Member
    Join Date
    Mar 2001
    Posts
    536
    Thanks for letting me know that.
    Does the script have to be placed on the button or the keyframe?

    Does this get placed on the instance of the button? "popUpBtn"

    Can you explain "param,name,w,h,a,b,c,d,e,f,g"

    Thank you for your help.

  11. #11
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    in my post - 04-01-2006, 10:00 AM
    popUpBtn is the instance name of a button

    param,name,w,h,a,b,c,d,e,f,g - these are the parameters passed to the function named openLink

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