Actionscript 3 1120:访问未定义的属性

Actionscript 3 1120:访问未定义的属性,actionscript-3,flash,Actionscript 3,Flash,当我试图从videoPlayer movieclip内部访问按钮movieclip时,收到此错误消息。它们不是嵌套的。当单击videoPlayer按钮时,屏幕底部的按钮将让开,同时videoPlayer将位于其先前的位置。关闭视频播放器时,我希望按钮从屏幕右侧返回到tween,但我收到以下错误消息“1120:Access of undefined property TweenMax.from(btn1,3,{x:450,y:209.1,ease:back.easeOut})我的问题是,在as3中

当我试图从videoPlayer movieclip内部访问按钮movieclip时,收到此错误消息。它们不是嵌套的。当单击videoPlayer按钮时,屏幕底部的按钮将让开,同时videoPlayer将位于其先前的位置。关闭视频播放器时,我希望按钮从屏幕右侧返回到tween,但我收到以下错误消息“1120:Access of undefined property 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;
        }
}
flvPlayer脚本:-
停止();
closeBtn.addEventListener(MouseEvent.CLICK,closeVid)
closeBtn.buttonMode=true;
函数closeVid(e:MouseEvent):无效
{
video.stop();
gotoAndStop(1);
TweenMax.from(btn1,3,{x:450,y:209.1,ease:Back.easeOut});
}
**********************************************************************
视频播放器或场景外部的脚本1:-
导入com.greensock.*;
导入com.greensock.com;
变量numberOfButtons:Number=3
var startX:编号;
var startY:数字;
var currentButton:MovieClip

对于(var i:int=1;i当您使用
gotoAndStop(1);
时,它移动到第一帧,其中btn1、btn2和btn3不存在

修复它会很困难,因为你需要将时间线从按住按钮的MovieClip或Sprite移动到一个单独的MovieClip中,这样就不会发生这种情况。

这个[“btn+i”]
让我感到害怕。