Compile these answers together for AS2 and AS3 using JS injection AND ExternalInterface (both methods work in BOTH languages)
AS2:
// to use javascript injection in a url request getURL("javascript:displayPost(" + postId + "," + feedId +");", "_self"); // to use the external interface import flash.external.ExternalInterface; ExternalInterface.call("displayPost",postId,feedId);
AS3:
// to use javascript injection in a url request navigateToURL(new URLRequest("javascript:displayPost(" + postId + "," + feedId +");"), "_self"); // to use the external interface import flash.external.ExternalInterface; ExternalInterface.call("displayPost",postId,feedId);
Note that in AS2 and AS3, the ExternalInterface method is the same (ExternalInterface was introduced in Flash 8 for AS2). And in AS2 and AS3, the javascript injection method is the same, except that it navigateToURL instead of getURL, and the url string ends in a new URLRequest () because it needs a URLRequest object. Also, when using javascript injection, it is recommended to set the target window to "_self" so as not to open a new tab or window.
source share