0
我試圖創建一個使用動作腳本3.0的程序,其中單擊一個元素,單擊另一個元素,第一個元素轉到第二個元素。錯誤使用數組更改動畫片段的x和y位置
這是我的代碼:
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.display.MovieClip;
import flash.events.MouseEvent;
stop();
var Plchange:MovieClip;
var As:Array = new Array(A1,A2,A3,A4,A5,A6,A7,A8,A9);
var Bs:Array = new Array(B1,B2,B3,B4,B5,B6,B7,B8,B9);
var Cs:Array =new Array(C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12);
var Cs1:Array=new Array(C13,C14,C15,C16,C17,C18,C19,C20,C21,C22,C23,C24);
for (var i:int =0; i<=8 ;i++)
{
As[i].addEventListener(MouseEvent.CLICK, function(me:MouseEvent):void{ gotoPlace(me, As[i])});
Bs[i].addEventListener(MouseEvent.CLICK, function(me:MouseEvent):void{ gotoPlace(me, Bs[i])});
}
for (var Y:int =0; i<=12 ;Y++)
{
Cs[Y].addEventListener(MouseEvent.CLICK, function(me:MouseEvent):void{ Set(me, Cs[Y])});
Cs1[Y].addEventListener(MouseEvent.CLICK, function(me:MouseEvent):void{ Set(me, Cs1[Y])});
}
function gotoPlace(event:MouseEvent, boing:MovieClip)
{
boing = Plchange;
}
function Set(event:MouseEvent, clip:MovieClip)
{
Plchange.x = clip.x;
Plchange.y = clip.y;
}
我得到一個錯誤:
TypeError: Error #1010: A term is undefined and has no properties. at NineMen_fla::MainTimeline/frame1()
我要去哪裏錯了?請告訴我。
A1,A2,A3 ... MovieClip實例?通常實例變量和函數啓動小寫字符,類名開始大寫字符。 – ton