1120:访问未定义的属性

时间:2012-11-11 11:50:04

标签: actionscript-3 flash

当我尝试从videoPlayer movieclip中访问按钮movieclip时,收到此错误消息。它们不是嵌套的。单击videoPlayer按钮时,如果videoPlayer位于其先前位置,则按钮补间到屏幕底部。在关闭videoPlayer时,我希望按钮从屏幕右侧补间,但我得到以下错误消息" 1120:访问未定义属性TweenMax.from(btn1,3,{x:450,y :209.1,ease:Back.easeOut});.我的问题是我将在as3中使用什么来访问按钮的控制权,以便我可以在关闭videoPlayer movieclip时补间它们。任何指针都将非常感激。

The flvPlayer script:-

stop();

closeBtn.addEventListener(MouseEvent.CLICK, closeVid)
closeBtn.buttonMode = true;

function closeVid(e:MouseEvent):void
{
    video.stop();
    gotoAndStop(1);
    TweenMax.from(btn1, 3, {x:450, y:209.1, ease:Back.easeOut});
}

**********************************************************************

The script from outside the videoPlayer or scene1:-

import com.greensock.*;
import com.greensock.easing.*;

var numberOfButtons:Number = 3

var startX:Number;
var startY:Number;

var currentButton:MovieClip

for (var i:int = 1; i <= numberOfButtons; i++)
    {

        this["btn"+i].buttonMode = true;
        this["btn"+i].mouseChildren = false;
        this["btn"+i].addEventListener(MouseEvent.MOUSE_OVER, doRollover)
        this["btn"+i].addEventListener(MouseEvent.MOUSE_OUT, doRollout)
        this["btn"+i].addEventListener(MouseEvent.CLICK, showbtnContent);
    }

function doRollover(e:MouseEvent):void
{
    TweenMax.to(this[e.target.name], 1, {scaleX:1.1, scaleY:1.1, ease:Elastic.easeOut});
}

// This function handles the Rollout event  
function doRollout(e:MouseEvent):void
{
    TweenMax.to(this[e.target.name], 1, {scaleX:1, scaleY:1, ease:Elastic.easeOut});
}

function showbtnContent(e:MouseEvent):void
{
    currentButton = this[e.target.name]
    switch (currentButton)
    {
        case btn1:
        TweenMax.from(audioPlayer, 1, {x:449, y:-112, ease:Back.easeOut});
        audioPlayer.gotoAndStop(2);
        audioPlayer.parent.setChildIndex(audioPlayer, audioPlayer.parent.numChildren-1);
        break;

        case btn2:
        TweenMax.from(mcGallery, 1, {x:450, y:300, scaleX:1, scaleY:1, ease:Back.easeOut});
        mcGallery.gotoAndStop(2);
        mcGallery.parent.setChildIndex(mcGallery, mcGallery.parent.numChildren-1);
        break;

        case btn3:
        TweenMax.to(btn1, 20, {x:450, y:777.1, ease:Elastic.easeOut});
        TweenMax.to(btn2, 16, {x:450, y:777.1, ease:Elastic.easeOut});
        TweenMax.to(btn3, 12, {x:450, y:777.1, ease:Elastic.easeOut});
        TweenMax.from(flvPlayer, 3, {x:1060, y:280, ease:Back.easeOut});
        flvPlayer.gotoAndStop(2);
        flvPlayer.parent.setChildIndex(flvPlayer, flvPlayer.parent.numChildren-1);
        break;
        }
}

1 个答案:

答案 0 :(得分:0)

当你使用gotoAndStop(1);时,它移动到第一帧,其中btn1,btn2和btn3不存在。

修复它会很困难,因为你需要将时间轴移动到与按住按钮的MovieClip或Sprite分开的MovieClip中,这样就不会发生这种情况。