错误1046:类型找不到或不是编译时间常数 [英] Error 1046:Type was not found or was not a compile-time constant

查看:666
本文介绍了错误1046:类型找不到或不是编译时间常数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使CS6一个互动Flash视频的一类,我服用。我简要地谈到有关该教授,他无法弄清楚这个问题无论是。奇怪的是,它说错误是在第2和第3。当我删除code。关于这一思路,还是说,错误的是那些线。看看我的AS,告诉我你的想法。

I'm trying to make a interactive flash video in CS6 for a class I am taking. I briefly talked with the professor about this and he could not figure out the issue either. The weird thing is it says the errors are on lines 2 and 3. When I remove the code on those lines it still says the error is on those lines. Take a look at my AS and tell me what you think.

import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.display.Stage;
import flash.events.*;

public class Essay1 extends MovieClip{

public function Essay1() {

    mc_Gas.visible = false;
    mc_Drive.visible = false;
    mc_Outside.visible = false;
    mc_DriveZoom.visible = false;
    mc_Dash.visible = false;

    mc_Start.btn_Start.addEventListener(MouseEvent.MOUSE_DOWN, gotoWindow);
    mc_Drive.btn_Drive.addEventListener(MouseEvent.MOUSE_DOWN, gotoZoom);
}
public function gotoWindow(MouseEvent):void{
    mc_Start.gotoAndPlay(2);
}
public function gotoZoom(MouseEvent):void{
    mc_DriveZoom.visible = true;
    mc_DriveZoom.mc_Car3.mc_HeadDown.gotoAndPlay(2);
}

}

下面的错误消息:

F:\ WDMD201 \随笔\ Essay1.as,2号线1046:类型未发现的或没有编译时间常数:mc_Dash

F:\WDMD201\Essay\Essay1.as, Line 2 1046: Type was not found or was not a compile-time constant: mc_Dash.

F:\ WDMD201 \随笔\ Essay1.as,2号线1046:类型未发现的或没有编译时间常数:mc_Drive

F:\WDMD201\Essay\Essay1.as, Line 2 1046: Type was not found or was not a compile-time constant: mc_Drive.

F:\ WDMD201 \随笔\ Essay1.as,3号线1046:类型未发现的或没有编译时间常数:mc_Gas

F:\WDMD201\Essay\Essay1.as, Line 3 1046: Type was not found or was not a compile-time constant: mc_Gas.

F:\ WDMD201 \随笔\ Essay1.as,3号线1046:类型未发现的或没有编译时间常数:mc_Start

F:\WDMD201\Essay\Essay1.as, Line 3 1046: Type was not found or was not a compile-time constant: mc_Start.

F:\ WDMD201 \随笔\ Essay1.as,4号线1046:类型未发现的或没有编译时间常数:mc_Outside

F:\WDMD201\Essay\Essay1.as, Line 4 1046: Type was not found or was not a compile-time constant: mc_Outside.

F:\ WDMD201 \随笔\ Essay1.as,5号线1046:类型未发现的或没有编译时间常数:mc_DriveZoom

F:\WDMD201\Essay\Essay1.as, Line 5 1046: Type was not found or was not a compile-time constant: mc_DriveZoom.

推荐答案

的问题是,您试图访问未知属性。要访问它们,你需要声明的属性匹配舞台上的实例名称。声明所有属性 mc_Dash mc_Drive ,等等,成员变量:

The issue is that you are trying to access unknown properties. To access them, your need to declare properties matching the instance names on the stage. Declare all the properties mc_Dash, mc_Drive, and so on, as member variables :

public class Essay1 extends MovieClip {

    public var mc_Dash:MovieClip;

    public function Essay1 {
    ....

这篇关于错误1046:类型找不到或不是编译时间常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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