错误#1069:在Number上找不到属性y并且没有默认值

时间:2014-11-23 15:50:44

标签: actionscript-3

我使用下面显示的代码出现以下错误

  

TypeError:错误#1010:术语未定义且没有属性

我是新手使用类,所以它可能是一个混乱的代码,但我真的需要帮助xD。

我已经阅读了一篇关于有人在另一个问题上给我的课程的教程,但是我仍然遇到这些课程的问题... lol

package
{
import flash.display.Sprite;
import flash.display.Stage;

public class Notas
{
    public var stage:Stage;
    public var velocidad:int =  5;

    public var barra:Sprite = new Sprite();
    public var puntaje:int;

    public var i:int = 0;
    public var contador:int = 0;
    public var j:int = 0;

    public var notaS:Array = new Array(16);
    public var notaD:Array = new Array(16);
    public var notaF:Array = new Array(16);
    public var notaSPACE:Array = new Array(16);
    public var notaJ:Array = new Array(16);
    public var notaK:Array = new Array(16);
    public var notaL:Array = new Array(16);

    public function Notas(escenario:Stage)
    {
        stage = escenario;
    }

    public function Inicializar():void
    {
        asignarNotas();
        barra = drawRect(0xFF0000, 1280, 10, 0, 650);
        stage.addChild(barra);
        crearNotaS(0xFFFFFF, 30, 10, 0, 0);
    }

    public function Destruir():void
    {
        for (i = 0; i < notaS.length; i++)
        {
            if (notaS[i].y < 720 || barra.hitTestObject(notaS[i]))
            {
                    stage.removeChild(notaS[i]);
                    puntaje += 1;
                    trace (puntaje);
            }
        }
    }

            public function crearNotaS(color:int, ancho:int, alto:int, x:int, y:int):void
    {           
        for (i = 0; i < notaS.length; i++)
        {
            if (notaS[i] == 1 && i == 0)
            {
                notaS[i] = drawRect(color, ancho, alto, x, y);
                stage.addChild(notaS[i]);
                notaS[i].y = -alto / 2;
            }

            else if (notaS[i] == 0)
            {
                j += 1
            }

            else if (notaS[i] == 1 && i > 0)
            {
                notaS[i] = drawRect(color, ancho, alto, x, notaS[i].y + alto * j);
                stage.addChild(notaS[i]);
            }
        }
    }

    public function drawRect(color:uint, ancho:int, alto:int, x:int, y:int):Sprite
    {
        var dj:Sprite = new Sprite();

        dj.graphics.beginFill(color,1);
        dj.graphics.drawRect(0,0,ancho,alto);
        dj.graphics.endFill();

        dj.x = x;
        dj.y = y;

        return(dj);
    }

    public function asignarNotas():void
    {
        notaS[0] = 1
        notaS[1] = 1
        notaS[2] = 1
        notaS[3] = 1
        notaS[4] = 1
        notaS[5] = 1
        notaS[6] = 1
        notaS[7] = 1
        notaS[8] = 1
        notaS[9] = 1
        notaS[10] = 1
        notaS[11] = 1
        notaS[12] = 1
        notaS[13] = 1
        notaS[14] = 1
        notaS[15] = 1
    }

    public function moverNotas():void
    {
        for (i = 0; i < notaS.length; i++)
        {
            if (notaS[i] != 0)
            {
                notaS[i].y += velocidad;
            }
        }
    }
}
}

0 个答案:

没有答案