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.

Was it helpful?

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");
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top