A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Link to JS Prompt using NavigateToURL or similar?

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    373

    Link to JS Prompt using NavigateToURL or similar?

    I'm trying to create a link that when clicked upon brings up a JavaScript prompt in the browser requesting a password. I'm trying to figure out how to convert it using AS3 but no luck so far. Here's the code in HTML form I'm trying to convert.
    --
    <SCRIPT language="JavaScript"><!--
    function GateKeeper() {
    var password = prompt("Password required:", "");
    if (password) { this.location.href = password + ".doc"; }}

    //--></SCRIPT>
    <map name="Map" id="Map">
    <area shape="rect" coords="13,11,110,31" href="javascript:{;}" onClick="GateKeeper(); return false"/>
    </map>
    --
    and here's what I'm doing in Flash:
    --
    treatment.addEventListener(MouseEvent.MOUSE_DOWN, treat);
    function treat(evt:MouseEvent):void {
    navigateToURL("javascript:{;}" onClick="GateKeeper(); return false", “_self”);
    }

    with the JS still embedded in the page's HTML. How do I make the actual call in AS3?
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Use ExternalInterface rather than navigateToURL to call javascript.

  3. #3
    Senior Member
    Join Date
    Jul 2000
    Posts
    373
    Thanks. That did the trick.
    Adam Bell
    dzign@datatv.com
    --
    Over 90% of all websites
    suck......
    Join the minority.

Tags for this Thread

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