开发者

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

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 开发者_StackOverflow社区it's loaded into the new project, the hints dont clear. I know _root is garbling it somewhere, but I can't figure it out. Much appreciated.


Once loaded in a new movie, _root references the Main Movie root timeline, so your _root commands fails on the loaded movie.

You should change them in a _parent..... notation. For example if your _root command is 2 level nested in the loaded movie, you can refer to root as _parent._parent

or you can use this ugly solution:

_root.calc_mc..............

with this one the standalone swf will not work anymore.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜