与JAVA的不同,flex里面的Bound methods.
Bound methods 定义如下:
A bound method, sometimes called a method closure, is simply a method that is extracted from its instance.
和 Function Closure 的不同:
The key difference, however, between a bound method and a function closure is that the this reference for a bound method remains linked, or bound, to the instance that implements the method.
In other words, the this reference in a bound method always points to the original object that implemented the method. For function closures, the this reference is generic, which means that it points to whatever object the function is associated with at the time it is invoked。
调用的是bound method 时,那么该method 中的this 引用的是实现该方法的对象,并用该方法能够使用实现该方法的对象内的属性。。这一点和As2.0不同。
class ThisTest
{
private var num:Number = 3;
function foo():void // bound method defined
{
trace("foo's this: " + this);
trace("num: " + num);
}
function bar():Function
{
return foo; // bound method returned
}
}
var myTest:ThisTest = new ThisTest();
var myFunc:Function = myTest.bar();
trace(this); // output: [object global]
myFunc();
/* output:
foo's this: [object ThisTest]
output: num: 3 */
此代码中的全局this 和 Bound Function 里的this 引用的对象是不同的。
分享到:
相关推荐
This book presents a carefully selected group of methods for unconstrained and bound constrained optimization problems and analyzes them in depth both theoretically and algorithmically. It focuses on ...
Projected Gradient Methods for Non-negative Matrix Factorization Chih-Jen Lin Department of Computer Science Abstract Non-negative matrix factorization (NMF) can be formulated as a minimization ...
Android Service之bound实现
branch and bound
ADO Data Bound Class WizardADO数据类向导
lower_bound函数lower_bound函数用法及应用领域和案例分享lower_bound函数用法及应用领域和案例分享lower_bound函数用法及应用领域和案例分享lower_bound函数用法及应用领域和案例分享lower_bound函数用法及应用领域...
upper confidence bound implementation
Name salesDataSource is not bound in this Context,连接池的问题
配置tomcat7sqlserver数据连接池java 利用数据源对象建立数据库连接时的错误: Name jdbc is not bound in this Context 解决方案
NULL 博文链接:https://samson7b.iteye.com/blog/1393458
usb分析软件,可以查看系统里的usb设备,并有具体分析
1 S.5 Bounds on Performance: The Union Bound . . . . . . . . . . . . . 22 1.5.6 The Binary Symmetric Channel . . . . . . . . . . . . . . . . . . . 23 1 S.7 The BSC and the Gaussian Channel Model . . ....
MATLAB分支定界法求解,大家
No Hibernate Session bound to thread,没有绑定线程解决办法,找了好久才找到的
lower_bound函数
UIUC Math 482: Linear Programming. Lecture 33: The Branch-and-Bound Method(课程讲义)
Competitive Programming 3 The New Lower Bound of Programming Contests
cec2017 bound constrained 测试函数资料,包含测试函数代码,提交论文的结果,总结,函数定义,以及评价准则等信息
CEC 2017 bound constrained benchmarks_2017CEC_jso算法_jso_matlabbound_LSHADE_源码.zip
旅行商问题简称为TSP问题,是最基本的线路问题,该问题是在寻求单一旅行者由起点出发,通过所有给定的需求点之后,最后再回到原点的最小路径成本。TSP的经典精确算法主要包括贪心算法、动态规划算法、分支限界算法,...