AS3:调用gotoAndStop()上MainTimeline,从文档类 [英] AS3: Call gotoAndStop() on MainTimeline, from document class

查看:683
本文介绍了AS3:调用gotoAndStop()上MainTimeline,从文档类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得自己像一个总鹅为不必问这个,这是最后一块我的项目,它应该是非常容易解决:在这里/但是,访问过许多类似的问题,我可以报告说,没有证实的答案解决了我的问题。

基本上,我想gotoAndStop(3)在主时间轴上从我的文档类。不过,我似乎无法做到这一点。我已经试过两个以下,既不工作(无论抛出不同的错误)。

  VAR stageRef:舞台;
stageRef =阶段;
stageRef.gotoAndStop(3)
 

错误:

 线148 1061:调用可能未定义的方法gotoAndStop通过静态类型flash.display使用一个参考:第一阶段。
 

第二种方法:

  VAR MainTimeline:影片剪辑= this.parent为影片剪辑;
MainTimeline.gotoAndStop(3);
 

错误:

 线148 1042:在静态方法,此关键字不能使用。它只能在实例方法,函数闭包和全局code使用。
 

这两个解决方案都标记为工作/其他用户正确的,但我似乎无法让他们的工作。我觉得太傻了。任何帮助将大大AP preciated!干杯。

解决方案

 影片剪辑(根).gotoAndStop(3);
 

I feel like a total goose for having to ask this, it is the final piece of my project and it should be incredibly easy to solve :/ However, having visited many similar questions on here, I can report that no verified answers have solved my issues.

Basically, I want to gotoAndStop(3) on the Main Timeline from within my document class. However, I can't seem to do this.. I have tried both the following, and neither works (both throw different errors)..

var stageRef:Stage;
stageRef = stage;
stageRef.gotoAndStop(3)

Error:

Line 148    1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display:Stage.

The second method:

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

Error:

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.

Both the solutions were marked as working / correct by other users, but I can't seem to get them to work.. I feel so silly. Any help would be greatly appreciated! Cheers.

解决方案

MovieClip(root).gotoAndStop(3);

这篇关于AS3:调用gotoAndStop()上MainTimeline,从文档类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆