A Flash Developer Resource Site

Results 1 to 17 of 17

Thread: Pop-Up Windows w/Javascript

  1. #1
    Senior Member
    Join Date
    Dec 2000
    Posts
    440
    I am trying to create a html browser pop-up window with no menus, buttons, non-resizing etc... I want the scroll bars!

    Seeing that javascript can be put in the "get url" in KoolMoves"....

    What code would I use to open a browser (no menus-buttons etc..) kinda like the "openwindow()" javascript command???

    Thanks!

  2. #2
    Senior Member
    Join Date
    Dec 2000
    Posts
    440
    I have been working with this command...

    javascript:window.open('test.htm','targfrme','widt h=325,height=330,left=50,top=50')

    But I am getting erors... "line 1 & char 1" and "test is undefined"

    A new browser appears, then a second which is the window I want, it has the correct sizes etc..

    But my page is blank?

    Any Ideas?

    Thanks

  3. #3
    Junior Member
    Join Date
    Feb 2001
    Posts
    1

    Pop-Up Windows

    Hi there,

    It sounds like you are lacking the Javascript function which is required to do the pop-up?

    If you add in your head tags of the host page the same code but as follows, all should be well:

    function open_window(url)
    {
    open_window =window.open("fileto open","open_window","toolbar=0,location=0,director ies=0,status=0,menubar=0,scrollbars=0,resizable=0, width=300,height=200,top=100,left=50");
    }

    Altering the function name, sizes and options etc as needed. As far as I am aware this needs to be placed into the HTML document in which the SWF is embedded. I could be wrong there, but it's always worked for me.

    Hope this is not a case of up-the-garden-path! Do let me know!

    Jon

  4. #4
    Senior Bumbler
    Join Date
    Dec 2000
    Posts
    522

  5. #5
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    You need to add void(0); to the end of it to work. I don't know why but you need something to realese the variables for it to work.


    The command fromm Kool Moves would be javascript:window.open('url','windowname',attribut es);void(0);

    With version 1.85 what you will do is select javascript from the actions and then add my piece of code to the dialog.

    Chances are if you are getting an undifined error you followed the tut from flashkit but failed to place the Script before you embedded the SWF.


  6. #6
    Senior Member
    Join Date
    Dec 2000
    Posts
    440
    HELP!

    Hey Johnnie,

    This is the code I am using in the 1.85 ver of KM

    Javascript:window.open("test.htm","s","width=325,h eight=330,left=50,top=50");void(0);

    I entered it in the "Advanced-Javascript" window.

    I get my pop-up, but no content.
    Then I get another browser window with the word "[object]" in the html page.

    Why am I getting no content and 2 browsers (1 is the popup I want)?

    And why does my pop-up window locked in memory. My hour glass cursor keeps spinning and I can't move the popup?

    Thanks!

  7. #7
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    Okay, Using Kool Moves 1.85 and IE 5.0 , I entered this into the dialog:

    Javascript:window.open("http://www.google.com","s","width=325,height=330,left=50, top=50");void(0);

    Then I tested it in the web browser.

    The results was a square shaped window with Google loaded into it with no adress bar or navigation bar that was 325 px by 330 pix located on the left hand side of the screen. Since that was the case then the problem is not in the code itself.

    I then looked at how you are using your URL- I cut the http:// off and low and behold I got a simular error. I would say that you need the full URL. The other problem that I pondered that it could be is that your document is not in the same directory as the SWF file. Another problem is that IE 5.5 in the first realease did not like Javascript with SWF's. Yet another problem could be that IE for mac and netscape may not lock down the embedded window.

    Try using the full url (dont leave of the http:// or the www) and see if it works. Then check the version of your browser. If it is IE 5.5 then you will have to use FS Commands- which will not work for any MAC vfersion of IE, the Linux version of IE, Netscape 6, or Any version of IE or Netscape bellow IE 3.0 and NS 3.0. See this is what I mean by people not knowing what they are talking about. Most people will tell you to use FS commands to send Javascript instead of the javascript command but they do not realize that FS Commands cannot be used by more browsers than using the javascript command and in fact by making it work for IE 5.5 you exclude more people than you include.

  8. #8
    Senior Member
    Join Date
    Dec 2000
    Posts
    440
    Thanks Johnnie for your help..

    I entered this...

    Javascript:window.open("http://www.flashkit.com","s","scrollbars,width=325,height =330,left=50,top=50");void(0);

    the popup worked fine with content, but I am still getting a second browser.

    What now?

    p.s. I do use IE 5.5

    Thanks

  9. #9
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    What is in the second browser?

    It may be possible to close the extranous window using the window.document.close() method if what is in it is known or you may change focus to the newly opened window.

    If the second window is blank then that is a -ummm- feature of IE 5.5.


  10. #10
    Senior Member
    Join Date
    Dec 2000
    Posts
    440
    Johnnie,

    The second browser is a full browser (menus, buttons etc..)

    In the html page is the word "[object]"

    Plus I tried the code somewhere else using IE 5.0 and it does the same thing as IE 5.5

    This code is the same code that I use on my regular web pages, and the popup works fine.

    Thanks

  11. #11
    Senior Member
    Join Date
    Dec 2000
    Posts
    107

    Smile try this!! :)

    -stick this on your button:

    on (release) {
    getURL ("JavaScriptpenWindow(\"your-page-to-open.html/\",\"150\",\"150\")");
    }

    -nb:// the 150 by 150 is the size of the pop up window!!)
    -and stick this in your web page (where your .swf is embed), between the <head> tags:

    <script language="JavaScript">
    <!-- hide from JavaScript-challenged browsers
    function openWindow(url, w, h) {
    var windowprops = "width=" + w + ",height=" + h;
    popup = window.open(url,'remote',windowprops);
    }
    // done hiding -->
    </script>

    and tell me if it works (mail me: the notification is not working )

    good luck

    lafish
    [email protected]

  12. #12
    Senior Member
    Join Date
    Dec 2000
    Posts
    107

    be carefull : i did not put the red face(smily)

    in the middle of my script a red face has slipped (a smily!!!) in fact you have to replace it with ":" ans "o".
    mea culpa!!
    lafish.

  13. #13
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    I am not getting that response and I just updated to IE 5.5 What I am getting is a small pop-up with the URL loaded into it-

    I made a screenshot of the action for you.









    Lafish what you are suggesting works- IN FLASH 4 and 5!!!- but will unfortunatlty not work in Kool Moves as Flash 5 Actionscripting is slated for the Kool Moves Pro edition and is not available in Kool Moves version 1.85.



  14. #14
    Senior Member
    Join Date
    Dec 2000
    Posts
    440
    Johnnie...

    I used the exact code you have above...

    now I get one browser, but no formatting...

    I don't know why it works for you but not me..

    I have tried it in IE 5 & 5.5
    I also am using Win98 1st & Sec editions (2 seperate pc's)

    I'll keep trying

    Thanks for your help!

  15. #15
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    I tested it on a Win 95 IE 5.5 (Latest version) and Win 98 version 2 with IE 5.0.

    I could put the fun file up and allow you to download that?

    Grab it fast as Geocities routinly grabs Zips off of their servers:

    http://www.geocities.com/jsnider.geo/Popup.zip


    If this does not work then their is something else wrong.

  16. #16
    Senior Member
    Join Date
    Jul 2000
    Posts
    5,087
    PS. you will need to cut and paste that address in to your browser in order for the download to work!!!

    Gota love Geocities

  17. #17
    Senior Member
    Join Date
    Dec 2000
    Posts
    440
    Johnnie...

    I tried it on my machine...

    and I am getting two browsers and no content..

    I has to do with my machines and not KM or the code.

    Thanks

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