Question

function showAlert():void
{
    var alert:URLRequest = new URLRequest("javascript:alert('Please enter your User name')");
    navigateToURL(alert, "");
}

I can't see the alert box (pop-up) after clicking button. What is the source of the problem? Even if I tried 3 different browser it doesn't work.

Était-ce utile?

La solution

ExternalInterface is the standard way of communicating between AS3 and JS (see documentation):

import flash.external.ExternalInterface;

function showAlert() 
{
    // Check ExternalInterface is available
    if (ExternalInterface.available) 
    {
        ExternalInterface.call("alert", "Please enter your User name");
    }
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top