samedi 28 novembre 2015

Is it possible to make use of a value returned from a method called by a delegate?

While experimenting with a basic coding stuff, I wondered, if a value returned by a method called by a delegate, could be used or captured. In other words, where will the return value will go ?

For example :

class Main extends Sprite
{
   public var mc:MyMc;

   function Main()
  {
      mc.addEventListener( "myClick" , myClick);

  }

  function myClick(e:Event):String  //returning a string 
  {
     return "What happens to this return value ???" 
  }


}



class MyMc extends MovieClip
{

   function MyMc()
  {
      addEventListener( MouseEvent.CLICK , onClick);

  }

  function onClick(e:Event):String  //returning a string 
  {
     dispatchEvent(new Event("myClick")); 
  }


}

Aucun commentaire:

Enregistrer un commentaire