javascriptutil.as
来自「拓扑图基于SNMP数据采集模块的设计和实现」· AS 代码 · 共 35 行
AS
35 行
package com.yahoo.astra.utils{ import flash.external.ExternalInterface; /** * Utility functions for working with JavaScript and ExternalInterface. * * @author Josh Tynjala */ public class JavaScriptUtil { /** * Creates an ActionScript delegate for JavaScript functions that need * to be called from components. * * <p>Example: A List's labelFunction.</p> * * @param functionName The name of the globally-accessible JavaScript function to call. */ public static function createCallbackFunction(functionName:String):Object { var delegate:Object = {functionName: functionName}; delegate.callback = function(...rest:Array):String { //we need to pass the variables like regular parameters rest.unshift(delegate.functionName); //OMG, this is confusing as heck, but clever, no? //apply() is deliciously awesome. return ExternalInterface.call.apply(ExternalInterface, rest); } return delegate; } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?