开发者

AS3: How can I access a movieclip in a different scene?

开发者 https://www.devze.com 2023-01-01 17:40 出处:网络
I want to access a MovieClip in another scene than I\'m currently in. More specific I want to set a TextField to a certain value from a \"preloader\"-scene. This is for handling totally dynamic langu

I want to access a MovieClip in another scene than I'm currently in.

More specific I want to set a TextField to a certain value from a "preloader"-scene. This is for handling totally dynamic language phrases. Maybe this is the wrong way.

I'm loading a XML with language phrases that I want to replace the textfields with.

We could do this by altering all MovieCli开发者_JAVA百科ps, but I think this could be a smart solution, if it's possible! :)


Have a look at my answer to this question (internally, scenes are just frames as far as Flash is concerned, so that answer applies to you as well). MovieClips that don't exist in the current frame haven't been instantiated yet, so they can't be accessed - the solution is either to move to the frame where the target is, to move the target so that it exists in the current frame (even if it's offstage), or to delay initializing the target until the frame where it gets instantiated.

0

精彩评论

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

关注公众号