use ExternalInterface. that way it is possible to call from inside Flash a function of the host application. so it doesn't matter whether your swf is hosted in HTML, a Java app or a C# app or whatever.
Flash:
Code:
import flash.external.*;
function callHost():Void
{
ExternalInterface.call("anyFunction");
}
myButton.onPress=callHost;
you can even send parameters that way, just look in Flash help.
make sure that your host app provides a function called "anyFunction". e.g. JavaScript in HTML:
Code:
<html>
<head>
<script language="JavaScript" type="text/javascript">
function anyFunction() {
/* do something */
}
</script>
</head>
<body>
<!-- Embedding code for Flash movie -->
</body>
</html>