Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    This is probably really a javascript question but I have a flash movie in a pop-up window. The movie has an invisible button covering the entire page. When this button is clicked, I need for it to make the window below (Main page) to go to the URL. Does anyone know how to do this?

    Thanks,

    Scott
    IP

  2. #2
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    This is probably really a javascript question but I have a flash movie in a pop-up window. The movie has an invisible button covering the entire page. When this button is clicked, I need for it to make the window below (Main page) to go to the URL. Does anyone know how to do this?

    Thanks,

    Scott
    IP

  3. #3
    Join Date
    Jan 2001
    Location
    Vancouver, BC, Canada.
    Posts
    55

    Default

    Use this:

    function redirectOpener(url){
    //If user came directly to the page by accident
    if (!self.opener){
    self.opener=self;//Open in the same window
    }
    window.opener.location=url;
    }

    Button action:
    on (release) {
    getURL ("javascript:redirectOpener('http://www.thesite.com')");
    }

    Couple of points to remember:
    Not necessarily going to work in all browsers and on all platforms.
    This will work Only if the window was "popped up" with javascript function.

    Test it in deferent browsers and let me know works for you.
    Good luck.

    Alex Dzhulay.
    www.linecraft.com
    IP

  4. #4
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    I tried the script you gave me and it works on IE & Netscape. But Netscape gives me an illegal operation when I try to close the pop-up window. Any idea on how to make that script close the pop-up window as well? I would think it would be as simple as adding "window.close". I'll play around with it but my javascripting skills are very limited.

    Thanks again,

    Scott
    IP

  5. #5
    Join Date
    Jan 2001
    Location
    Vancouver, BC, Canada.
    Posts
    55

    Default

    After reading your last message I checked the function in IE6, Netscape 4.75, Netscape 6.1 and Opera 5.12 on Windows ME. Worked in all browsers. I used the regular window X button to close the popup window.

    If you wanted "window.close" check your code again and I am sure you will find a bug Netscape simply can not forgive.
    Good luck. [img]/infopop/emoticons/icon_razz.gif[/img]

    Alex Dzhulay.
    www.linecraft.com
    IP

  6. #6
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    As it turns out, I will have to use another pop-up window instead of controling the main browser window after all. Reason being is that if the main window is closed and all that remains is the pop-up window, nothing happens when the button is pressed. If there is a workaround for that I would really like to know but if not, I'll just stick to the button opening a new window.

    Thanks Alex,

    Scott
    IP

  7. #7
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    Hey Alex,

    I meant to include this in my last posting but forgot to mention this. The problem I spoke of with Netscape was a "freak of nature" I guess. After I rebooted my machine and tried it again, it worked fine. I really don't know what was happening before but I had been using some "memory hogging" programs (Fireworks, UltraDev, etc.) and maybe my PC was just running out of memory or something.

    Thanks again for all your help.

    Scott
    IP

  8. #8
    Join Date
    Jan 2001
    Location
    Vancouver, BC, Canada.
    Posts
    55

    Default

    You are welcome Scott.
    BTW if you want the url to open in the new window you can change the function to following:


    function redirectOpener(url){
    //If user came directly to the page by accident or closed the opener window

    if (!self.opener){
    //Open in the new window
    window.open(url,"myname", "width=, height=");
    }
    else{
    window.opener.location=url;
    }
    }
    IP

  9. #9
    Join Date
    Aug 2000
    Location
    Dallas, Tx
    Posts
    277

    Default

    Oh man, I'm still haggling over this pop-up window thing. Here is what I've decided to do (and I can't figure it out):

    The main page is re-directed while a pop-up window appears (this much I've got). Where I'm having trouble is on the pop-up window itself. There are two links on the pop-up. One simply closes the window with a simple "window.close" script. The other link is where I'm having trouble. I need for this link to close the pop-up window while directing the main page to a URL but IF the main page is closed, I need for it to close the first pop-up window while opening a second pop-up window at a certain size.

    Any ideas on that?

    As always, thanks for any help.

    Scott
    IP

  10. #10
    Join Date
    Jan 2001
    Location
    Vancouver, BC, Canada.
    Posts
    55

    Default

    Scott,
    Look at the code I've written above.
    The function can easily be modified to do exactly what you want. Use "window.close" for the second button as well, but also call the function "onunload" in your popup window.

    function redirectOpener(url){
    //If user came directly to the page by accident or closed the opener window

    if (!self.opener){
    //Open in the new window
    window.open(url,"myname", "width=, height=");
    }
    else{
    window.opener.location=url;
    }
    }

    Then in the body tag
    <body onunload="redirectOpener[)">


    BTW you sound like a guy who loves Flash and wants to be able to do some more-less complicated stuff.
    You just got to learn some JavaScript, man! It's just a sin not to because there are so many resources available on line for FREE.It's not a rocket science and it's definitely going to pay off.
    I am a designer, not a programmer but as much as I hated it I took the time to learn the basics.
    Don't let whatever you've got go to waste.

    Good luck [img]/infopop/emoticons/icon_razz.gif[/img]
    IP

 

 

Bookmarks

Posting Permissions

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