[英]Flash and _root and levels - Loading SWF into another SWF
I'm loading an old formula calculator into a new project I'm working on; 我正在将一个旧的公式计算器加载到我正在处理的新项目中; pretty simple...
很简单...
this.createEmptyMovieClip("calc_mc", 0);
loadMovie("calc.swf", calc_mc);
Everything's fine...But, these commands clear the 'hints' in the form fields in the original calc.swf 一切都很好...但是,这些命令清除了原始calc.swf中表单字段中的“提示”
if (my_txt != null) {
var mc = my_txt._name + "Hint";
if (my_txt.length > 0) {
_root[mc]._visible = false;
} else {
_root[mc]._visible = true;
}
}
_root[this._name + "Hint"]._visible = false;
SWF works fine on it's own, but once it's loaded into the new project, the hints dont clear. SWF本身可以很好地工作,但是一旦将其加载到新项目中,提示就不会清除。 I know _root is garbling it somewhere, but I can't figure it out.
我知道_root在某处乱码,但我无法弄清楚。 Much appreciated.
非常感激。
Once loaded in a new movie, _root
references the Main Movie root timeline, so your _root commands fails on the loaded movie. 加载到新影片中后,
_root
引用主影片根时间轴,因此您的_root命令在加载的影片上失败。
You should change them in a _parent
..... notation. 您应该以
_parent
.....表示法更改它们。 For example if your _root command is 2 level nested in the loaded movie, you can refer to root as _parent._parent
例如,如果您的_root命令嵌套在加载的影片中为2级,则可以将root称为
_parent._parent
or you can use this ugly solution: 或者您可以使用以下丑陋的解决方案:
_root.calc_mc..............
with this one the standalone swf will not work anymore. 有了这个,独立的瑞士法郎将不再起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.