不明白错误1119

时间:2014-01-29 08:31:40

标签: actionscript-3

我有错误1119,我无法理解为什么。它让我疯狂 !

我有一个名为“useBox”的movieclip,在我的Engine.as

中调用
package com.laserdragonuniversity.alpaca {
    public class Engine extends MovieClip{
            public static var toolbar:Toolbar;
            public static var useBox:UseBox;

    public function Engine(){

    private function configLoaded(e:Event):void{
    useBox = new UseBox(stage, usableItems[0]);

    private function examine(e:MouseEvent):void{
                    stage.dispatchEvent(new Event("itemClicked"));
                        useBox = new UseBox(stage, e.currentTarget);
                        useBox.x = mouseX;
                        useBox.y = mouseY;
                        stage.addChild(useBox);
                    }

我有一个UseBox类:

UseBox.as:

package com.laserdragonuniversity.alpaca {
public class UseBox extends MovieClip{
public function UseBox(stageRef:Stage, thisThing:Object){
            this.stageRef = stageRef;
            this.thisThing = thisThing;
            toolbar = Engine.toolbar;
            batiments = Engine.batiments;

            this.visible = true;
            useButton.visible = false;
            useButton2.visible = false;
}

在Puzzle.as课程中,我试图让useButton可见。

package com.laserdragonuniversity.alpaca {
public class Puzzle extends MovieClip{
private var toolbar:Toolbar;
        private var useBox:UseBox;

public function Puzzle(stageRef:Stage){
            useBox = Engine.UseBox;

public function clickEmplacement2(event:MouseEvent):void {
useBox.useButton2.visible = true;
}

但是我得到了错误1119:通过带有静态类型Class的引用访问可能未定义的属性UseBox。 (对于“useBox = Engine.UseBox;”)行

你知道为什么吗?

1 个答案:

答案 0 :(得分:0)

看起来你的问题是Engine.UseBox;是大写的,所以代码认为你在讨论类UseBox,而不是实例Engine.useBox;