Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    New Coder
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Please check my code for pop ups in flash!

    Hi,

    I couldn't find a thread with my exact problem..basically I have this button in flash to popup a window:

    on (release) {
    //customize the window that gets opened
    // 0 equals NO.
    // 1 equals YES.
    address = "/RG_Map.pdf", "_blank";
    target_winName = "R G Community Map";
    width = 700;
    height = 700;
    toolbar = 0;
    location = 0;
    directories = 0;
    status = 0;
    menubar = 0;
    scrollbars = 0;
    resizable = 0;
    //sends data back to the function
    openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
    }

    It works fine in Firefox, Safari and Chrome, but I cannot open it in IE7. Has anyone found a solution? The window simply won't popup. This has occured on many machines, so I don't think it's a blocker.

    Thanks so much!

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Do you have the code for the openWinCentre function?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    New Coder
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your response.

    Surprisingly (or stupidly) I don't have the code for openwincentre -it was a copy and paste from some button tutorial. I did a quick search on it and read that openwincentre must be on the _root first frame.

    How would I input the _root code? (My popup windows are different sizes) or
    Is the openwincentre necessary?

    Thanks.

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Do you have a link to this tutorial? I can't really help with this specific code without knowing more.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #5
    New Coder
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I used the tutorial found here:

    http://www.kirupa.com/developer/mx/centered_popup.htm

    Thanks!

  • #6
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Ok yes that function is necessary, and you should place it on the first frame in the main timeline.

    Its a bit complex, you could also just have

    Code:
    on (release) {
    getURL ("javascript:NewWindow=window.open('ShowPopup.php','newWin','width=400,height=300,left=0,top=0,
    toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No');  NewWindow.focus();
    void(0);");
    }
    http://www.flash-db.com/PopUp/JavaSc...pUp.php?page=2
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #7
    New Coder
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, I inputted that code into the first frame in the main timeline and it still doesn't work. This is what I put in:


    _root.openWinCentre = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {

    getURL ("javascript:var myWin; if(!myWin || myWin.closed){myWin = window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h + ",toolbar=" + toolbar + ",location=" + location + ",directories=" + directories + ",status=" + status + ",menubar=" + menubar + ",scrollbars=" + scrollbars + ",resizable=" + resizable + ",top='+((screen.height/2)-(" + h/2 + "))+',left='+((screen.width/2)-(" + w/2 + "))+'" + "')}else{myWin.focus();};void(0);");

    }



    I then tried your second recommendation and the Flash compiler identified a few errors that I couldn't fix.

    What do you recommend?

  • #8
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Well the fact that it worked the first time around in all but IE, really does suggest that its a popup blocker. I just tested the file on the tutorial site and it blocked it on my IE. Are you 100% sure its not a blocker?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #9
    New Coder
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm certain it's not. I downloaded the tutorial files into my domain and it worked. I then copied the exact code from the tutorial and pasted it into my flash file and it didn't work. The only thing I can think of is that that button is not on the main layer, as the tutorial button is?

  • #10
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    So we are still at square 1? It works in all but IE, can you load it onto a site so I can test it with my IE?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #11
    New Coder
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My site is:

    www.rossdalegreen.ca

    I could send you the flash file as well.

    Thanks!

  • #12
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    I'm getting JS errors. Honestly that function is a bit...much so lets cut it down. Also the winName probably should be one word.

    Code:
    on (release) {
    //customize the window that gets opened
    // 0 equals NO.
    // 1 equals YES.
    address = "/RG_Map.pdf", "_blank";
    target_winName = "RGCommunityMap";
    width = 700;
    height = 700;
    
    //sends data back to the function
    openWinCentre(address, target_winName, width, height);
    } 
    
    
    
    _root.openWinCentre = function (url, winName, w, h) {
    
    getURL ("javascript:window.open('" + url + "','" + winName + "','" + "width=" + w + ",height=" + h + ");");
    
    }
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #13
    New Coder
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So, I tried your code and it still doesn't work.. I used the first part of the code for the button and the second part for the main frame. The only difference now is the newly coded button does not display a "Error on page." notice like the other buttons do.

    I appreciate the help, Jeremy.

  • #14
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Well thats progress. The button is working, something with the javascript is not. Honestly its not my strength, perhaps you should ask there. Either way, you can test Javascript directly by putting it into the address bar. I am also guessing its possible one of our parameters is off?

    Code:
    address = "/RG_Map.pdf";
    If you don't care to have a function for this, then just try this.

    Code:
    on (release) {
    getURL ("javascript:window.open('/RG_Map.pdf','RGCommunityMap','width=700,height=700');");
    }
    Here is a reference for the window.open method

    http://www.pageresource.com/jscript/jwinopen.htm
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #15
    New Coder
    Join Date
    Apr 2009
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It worked! It created another problem, though: the window pops up fine, but the main window goes white and displays this:

    [object]

    So close!


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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