Flex: Sending parameters to Alert closeHandler

后端 未结 4 2120
天涯浪人
天涯浪人 2020-12-19 03:37

Is it possible to send parameters to a closeHandler Alert function? The fisrt parameter the function gets is the CloseEvent, but how to send another one?

<         


        
4条回答
  •  失恋的感觉
    2020-12-19 03:58

    This should be possible using Flex's dynamic function construction. A similar question was asked here.

    Here's an example:

    The parameters and handler:

    var parameters:String = "Some parameter I want to pass";
    
    private function loadLocalData(e:Event, parameter:String):void
    {
      // voila, here's your parameter
    }
    
    private function addArguments(method:Function, additionalArguments:Array):Function 
    {
      return function(event:Event):void {method.apply(null, [event].concat(additionalArguments));}
    }
    

    Your component:

    
    

提交回复
热议问题