A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: using geturl to call javascript alert don't work properly

  1. #1
    Member
    Join Date
    May 2003
    Posts
    69

    using geturl to call javascript alert don't work properly

    I have a button in flash linking to a html using getURL. But I want to pop up a alert window when the using click on the button. So I try something like this:

    function onclick() {
    getURL("javscript:alert('say something')");
    getURL("somewhere.html");
    }

    But this does popup the alert box, just goes to the html page. If I remove the line getURL("somewhere.html"); and just leave the getURL("javscript:alert('say something')"); in, it will popup.

    I am confused, can someone help me out.

    Cheers

    Tony

  2. #2
    Flashkit Jedi

    Join Date
    Jul 2001
    Location
    Coruscant System
    Posts
    3,426
    What you're doing is expecting it to pause (like VB would) and wait for the user to click ok on the alert. But I'm affraid flash wont do that. All flash see's is that there are two getURL commands there and it does one after the other and the seconds command is executed before the first one has had time to complete, thus the second url is visited.

    XFM

  3. #3
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    combine them in a function in the html doc
    Code:
    <head>
    <script language="javascript">
    function o() {
    alert("say something");
    location.href="something.html";
    }
    </script>
    </head>
    code:

    getURL("javascript:o();");


  4. #4
    Member
    Join Date
    May 2003
    Posts
    69
    Thanks guys

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