In Flash: gotoAndStop and nested MovieClip issues

In Flash: gotoAndStop and nested MovieClip issues

眼泪淡了忧伤 发布于 2021-11-29 字数 1294 浏览 775 回复 2 原文

This is kind of an odd question, I hope this enough information to go on:

In the flash IDE, I have a MovieClip that has 3 frames. In each frame, I have a series of TextFields. It's a poor mans viewstack basically - so here's the issue - in FP10 I can write the following code with no problem:

public function showMenu():void{

     textItem.text = "This worked."


where "this" is a MovieClip and textItem is a TextField that is only on the second frame of the movieClip. If I target FP9 and run the same code, I get a 1009 Error about trying to reference a property on an object that is null.

I understand that it is trying to access that property before it was completely instantiated, what I don't understand is why it works in FP10 and not FP9? What could have changed in the flash player to allow this?


Looks like some weirdness in FP9 - a workaround can be found here:

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。



需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。


雪化雨蝶 2022-06-07 2 楼

I've generally found that when you have objects on the timeline, in order to access them with actionscript, they have to be on all the frames of the timeline, you'll just have set their visibility to hidden when they're not supposed to be on screen. I'm pretty sure I've run into this problem with fp10 as well as fp9, so I'm surprised your code actually works for you in fp10.

走野 2022-06-07 1 楼

Yes, it has changed. This was possible in as2 but disappeared in as3, taking much of the simplicity of shorter timeline scripts with it. So, it was reinstated in FP10. I've read a blog post by someone at adobe about this, but i can't find it right now.