Posted By

MacEvelly on 07/24/09


Tagged

url as3


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

arpo
dubogii


Reusable URL function


 / Published in: ActionScript 3
 

Simplifies a button to use only one function for URL navigation.

  1. btn1.addEventListener(MouseEvent.CLICK, myLink("http://www.MacEvellyIsAwesome.com/"));
  2. btn2.addEventListener(MouseEvent.CLICK, myLink("http://www.NoReallyHeIs.com/"));
  3. btn3.addEventListener(MouseEvent.CLICK, myLink("http://www.OkMaybeJustCool/"));
  4.  
  5.  
  6. function myLink(link:String):Function {
  7. var myLinkReturn:Function = function(evt:MouseEvent){
  8. navigateToURL(new URLRequest(link), "_self")
  9. }
  10. return myLinkReturn
  11. }

Report this snippet  

You need to login to post a comment.