参考Flex中的javascript回调函数
下面的代码展示了如何在 Flex 中传递回调函数。
我需要将名为“jsf”的 JavaScript 回调函数传递给 f1。
如何创建对 .js 文件中的回调函数“jsf”的引用?
IE。 f1(jsf);
function f():void { trace("I am callback"); }
var v:Vector.<Function> = new <Function>[];
function f1(callBack:Function):void
{
trace("I register callBack");
v.push(callBack);
}
function f2():void
{
trace("I call the callBack");
v[0]();
}
f1(f);
f2();
谢谢
The code below shows how to pass a callback function in Flex.
I need to pass a javascript callback function named 'jsf' to f1.
How would I create a reference to the callback function 'jsf' which is in a .js file?
ie. f1(jsf);
function f():void { trace("I am callback"); }
var v:Vector.<Function> = new <Function>[];
function f1(callBack:Function):void
{
trace("I register callBack");
v.push(callBack);
}
function f2():void
{
trace("I call the callBack");
v[0]();
}
f1(f);
f2();
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想您正在寻找这个:
http: //help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html
和调用方法,更多信息请参见:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf626ae-7fe8.html#WS2db454920e96a9e51e63e3d11c0bf69084-7f31
I think you're looking for this:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html
and the call method, more on it here:
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf626ae-7fe8.html#WS2db454920e96a9e51e63e3d11c0bf69084-7f31