Actionscript 2.0 (AS2)
On the top level Button or MovieClip apply following actionscript:on (release) {
getURL(_root.clickTAG, '_blank');
}
Or you can also do it by MovieClip or Button instance name:click_btn_name.onRelease = function(){
getURL(_root.clickTAG, '_blank');
}
方法一:
Actionscript 3.0 (AS3)
Give the Button some instance name for example click_btn and add following actionscript:import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.net.navigateToURL;
click_btn.addEventListener(MouseEvent.MOUSE_UP, onClick);
function onClick(e:MouseEvent):void {
var click_url:String = root.loaderInfo.parameters.clickTAG;
if(click_url) {
navigateToURL(new URLRequest(click_url), '_blank');
}
}
方法二:
// ONLY NEED FUNCTION LISTED ONCE!!! function getClickTag():String{ for (var key:String in root.loaderInfo.parameters) if(key.toLowerCase()=="clicktag") return root.loaderInfo.parameters[key]; return ""; } // END FUNCTION // NEED THIS FOR EACH BUTTON - NOTE TO CHANGE THE "clicker_mc" to MATCH YOUR INSTANCE NAME clicker_mc.addEventListener(MouseEvent.CLICK,function():void { navigateToURL(new URLRequest(getClickTag()),"_blank"); });