ActionScript to Javascript Communication with ExternalInterface
Download the FLA used here