actionscript 3.0 中的数组错误

Array error in actionscript 3.0

我在这里尝试使用 x 轴和 y 轴来移动卡,它显示以下错误:

TypeError: Error #1010: A term is undefined and has no properties. at GamePlay/moveNext()[D:\TrainingAS3\GamePlay.as:71]

当我点击移动卡片的按钮时,它会显示在此语句中

Globe.self.realstage.TweenLite.to(anEntry['card'], .4, { 
 x:anEntry['x'], y:anEntry['y'], onComplete:moveNext } );


package 
{
    import flash.display.MovieClip;
    import flash.events.TimerEvent;
    import flash.events.MouseEvent;
    import com.greensock.*;
    import com.greensock.easing.*;
    import Globe;

    public class GamePlay 
    {
        var currentEntry:int = -1;

        var aList:Array =
            [
                {card:Globe.self.realstage.joker_mc, x:605.55, y:195.45},
                {card:Globe.self.realstage.king_mc,  x:323.80, y:298.45},
                {card:Globe.self.realstage.queen_mc, x:45.85, y:213.95},
                {card:Globe.self.realstage.a_mc,     x:605.55, y:195.45},
                {card:Globe.self.realstage.ten_mc,   x:323.80, y:298.45},
                {card:Globe.self.realstage.five_mc,  x:45.85, y:213.95},
                {card:Globe.self.realstage.two_mc,   x:605.55, y:195.45},
                {card:Globe.self.realstage.nine_mc,  x:323.80, y:298.45},
                {card:Globe.self.realstage.four_mc,  x:45.85, y:213.95},
            ];

        public  function onClick(e:MouseEvent):void
        {
            // Unsubscribe to avoid the mess with second click.

            Globe.self.realstage.click_mc.removeEventListener(MouseEvent.CLICK, onClick);


            // Start process.
            moveNext();
        }

        public  function moveNext():void
        {
            currentEntry++;

            // Stop the process if all the cards have been moved.
            if (currentEntry >= aList.length) return;


            // Get the entry.
            var anEntry:Object = aList[currentEntry];

            // Move the card.
            trace(card);

            Globe.self.realstage.TweenLite.to(anEntry['card'], .4, { 
     x:anEntry['x'], y:anEntry['y'], onComplete:moveNext } );


        }


}

你能请别人详细说明一下吗...

该错误意味着以下对象之一是 null/undefined:

self.realstage.TweenLiteanEntry

查看那些对象并看到您正在导入 com.greensock.*,问题出在 TweenLite

TweenLite 是 class,这意味着它不能是 realStage 的 属性(这是您尝试访问它的方式)。

要补救这种情况,只需直接引用 TweenLite class,因为您已经导入了它:

TweenLite.to(anEntry['card'], .4, {x:anEntry['x'], y:anEntry['y'], onComplete:moveNext } );

要进一步了解发生了什么,您可以研究静态属性和方法与常规属性和方法之间的区别。