开发者

flash paths binding, constants

开发者 https://www.devze.com 2022-12-09 08:09 出处:网络
is it possible to use string as path ? instead of _parent._parent.myVar=123; use something like this: var path = \'_parent._parent\';

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消