2012-11-11 121 views
1

當我嘗試從videoPlayer動畫片段中訪問按鈕movieclip時,出現此錯誤消息。它們不是嵌套的。點擊videoPlayer按鈕時,視頻播放器位於其先前位置時,屏幕底部的按鈕將不間斷地播放。在關閉videoPlayer時,我希望按鈕從屏幕右側返回,但我收到以下錯誤消息「1120:未定義屬性TweenMax.from(btn1,3,{x:450,y:209.1,緩解:Back.easeOut});.我的問題是我會怎麼使用AS3中訪問按鈕控制,所以我可以吐溫他們關閉錄像機影片剪輯任何指針將不勝感激1120:訪問未定義的屬性

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; 
     } 
} 
+0

'這[「btn + i」]'讓我感到畏縮。 – Taurayi

回答

0

時。您使用gotoAndStop(1);它移動到第一幀,其中btn1,btn2和btn3不存在

修復它會很困難,因爲您需要將時間線從MovieClip或Sprite移動到單獨的MovieClip中正在舉行按鈕,這樣就不會發生。