/ Published in: ActionScript 3
Simplifies a button to use only one function for URL navigation.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
btn1.addEventListener(MouseEvent.CLICK, myLink("http://www.MacEvellyIsAwesome.com/")); btn2.addEventListener(MouseEvent.CLICK, myLink("http://www.NoReallyHeIs.com/")); btn3.addEventListener(MouseEvent.CLICK, myLink("http://www.OkMaybeJustCool/")); function myLink(link:String):Function { var myLinkReturn:Function = function(evt:MouseEvent){ navigateToURL(new URLRequest(link), "_self") } return myLinkReturn }