Skip to content

Instantly share code, notes, and snippets.

@SeanJA
Created May 10, 2011 16:41
Show Gist options
  • Select an option

  • Save SeanJA/964852 to your computer and use it in GitHub Desktop.

Select an option

Save SeanJA/964852 to your computer and use it in GitHub Desktop.
oas clicktag
//-- Action Script 2 version:
//this is the click tag action
//that should be attached to your button
on (release){
getURL (_root.clickTAG, "_blank");
}
//-- Action Script 3 version:
/* Requires
* - Button symbol on Stage with instance name "myButton"
*/
myButton.addEventListener (MouseEvent.CLICK, buttonSymbol_click);
function buttonSymbol_click (evt:MouseEvent):void {
var clickTAG:String = loaderInfo.parameters.clickTAG;
// Check for malicious code injections, only use URLs if they begin with http: or https:
if ((clickTAG.substr(0, 5) == "http:") || (clickTAG.substr(0, 6) == "https:")){
var req:URLRequest = new URLRequest(clickTAG);
navigateToURL(req, "_blank");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment