Flex:向Alert closeHandler 发送参数 [英] Flex: Sending parameters to Alert closeHandler
本文介绍了Flex:向Alert closeHandler 发送参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将参数发送到 closeHandler Alert 函数?函数得到的第一个参数是CloseEvent,但是如何再发送一个呢?
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?
<s:Button id="btnLoadLocalData" label="Load data"
click="Alert.show('Populate list with local data?', '', Alert.YES | Alert.CANCEL, this, loadLocalData(???parameters???), null, Alert.OK);"/>
谢谢!
推荐答案
这应该可以使用 Flex 的动态函数构造来实现.在这里问了一个类似的问题.
This should be possible using Flex's dynamic function construction. A similar question was asked here.
这是一个例子:
参数和处理程序:
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));}
}
您的组件:
<s:Button id="btnLoadLocalData" label="Load data"
click="Alert.show('Populate list with local data?', '', Alert.YES | Alert.CANCEL, this, addArguments(loadLocalData, [parameters])), null, Alert.OK);"/>
这篇关于Flex:向Alert closeHandler 发送参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文