flash paths binding, constants
is it possible to use string as path ?
instead of _parent._parent.myVar=123;
use something like this:
var path = '_parent._parent';
and then use it 开发者_Go百科as
path.myVar=123';
You may use multiple []
.
for your example, you need _parent._parent
:
var path = '_parent';
this[path][path].myVar = 123;
another example:
var path1 = '_parent';
var path2 = 'apple';
this[path1][path2].myVar = 456;
//equals to _parent.apple.myVar = 456;
精彩评论