Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 AS3:从文档类在MainTimeline上调用gotoAndStop()_Actionscript 3 - Fatal编程技术网

Actionscript 3 AS3:从文档类在MainTimeline上调用gotoAndStop()

Actionscript 3 AS3:从文档类在MainTimeline上调用gotoAndStop(),actionscript-3,Actionscript 3,问这个问题让我觉得自己像一只鹅,这是我项目的最后一部分,应该非常容易解决:/然而,在这里访问了许多类似的问题后,我可以报告说,没有经过验证的答案解决了我的问题 基本上,我想从我的文档类中转到主时间轴上的goAndStop(3)。然而,我似乎不能这样做。。我尝试了以下两种方法,两种方法都无效(都会抛出不同的错误) 错误: Line 148 1061: Call to a possibly undefined method gotoAndStop through a reference wit

问这个问题让我觉得自己像一只鹅,这是我项目的最后一部分,应该非常容易解决:/然而,在这里访问了许多类似的问题后,我可以报告说,没有经过验证的答案解决了我的问题

基本上,我想从我的文档类中转到主时间轴上的goAndStop(3)。然而,我似乎不能这样做。。我尝试了以下两种方法,两种方法都无效(都会抛出不同的错误)

错误:

Line 148    1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:Stage.
Line 148    1042: The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code.
第二种方法:

var MainTimeline:MovieClip = this.parent as MovieClip;
MainTimeline.gotoAndStop(3);
错误:

Line 148    1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:Stage.
Line 148    1042: The this keyword can not be used in static methods. It can only be used in instance methods, function closures, and global code.

这两个解决方案都被其他用户标记为正常/正确,但我似乎无法让它们正常工作。。我觉得很傻。任何帮助都将不胜感激!干杯。

为帮助伙伴干杯:]然而,我再一次得到:第148 1120行:访问未定义的属性roothere您的文件/代码有一些不太正确的地方,因为这在我刚刚创建的测试中工作得很好。我阅读了外部和文档类(因为我对使用面向对象的方式使用Flash还比较陌生,而且我正在慢慢学习),我读到很明显,root属性是空的,除非文档类在显示列表上——这能解释为什么“root”对我来说是一个未定义的属性吗?(我没有理由将我的文档类添加到显示列表中)我想从这里开始,我的问题是,为什么我不能访问我的文档类的根属性,因为我所有的搜索都没有得到真正的答案:[不,我不认为这是你的问题。在没有看到代码/文件的情况下很难找到问题。
MovieClip(root).gotoAndStop(3);