0
您好我想作一個對象,在這種情況下,「ship_mc」,將3個不同的點在屏幕上,但我想使用Tween類。我不知道爲什麼它不工作,任何幫助將不勝感激。 我的代碼看起來像這樣使用AS3中的補間類將對象移動到多個位置?
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var myTween01:Tween = new Tween(this, "x", Regular.easeIn, 1416, 973, 4, true);
var myTween02:Tween = new Tween(this, "y", Regular.easeIn, 206, 446, 4, true);
var myTween03;
var myTween04;
var myTween05;
var myTween06;
myTween01.addEventListener(TweenEvent.MOTION_FINISH, onFinish);
function onFinish(e:TweenEvent):void {
myTween03:Tween = new Tween(this, "x", None.easeIn, 973, 695, 4, true);
myTween04:Tween = new Tween(this, "y", None.easeIn, 446, 222, 4, true);
}
myTween04.addEventListener(TweenEvent.MOTION_FINISH, onFinish1);
function onFinish1(e:TweenEvent):void {
myTween05:Tween = new Tween(this, "x", None.easeIn, 695, 374, 4, true);
myTween06:Tween = new Tween(this, "y", None.easeIn, 222, 239, 4, true);
}
,這是我得到
Symbol 'ship_mc', Layer 'Actions', Frame 1, Line 15 1067: Implicit coercion of a value of type fl.transitions:Tween to an unrelated type Class.
Symbol 'ship_mc', Layer 'Actions', Frame 1, Line 15 1188: Illegal assignment to class Tween.
Symbol 'ship_mc', Layer 'Actions', Frame 1, Line 16 1067: Implicit coercion of a value of type fl.transitions:Tween to an unrelated type Class.
Symbol 'ship_mc', Layer 'Actions', Frame 1, Line 16 1188: Illegal assignment to class Tween.
Symbol 'ship_mc', Layer 'Actions', Frame 1, Line 22 1067: Implicit coercion of a value of type fl.transitions:Tween to an unrelated type Class.
Symbol 'ship_mc', Layer 'Actions', Frame 1, Line 22 1188: Illegal assignment to class Tween.
Symbol 'ship_mc', Layer 'Actions', Frame 1, Line 23 1067: Implicit coercion of a value of type fl.transitions:Tween to an unrelated type Class.
Symbol 'ship_mc', Layer 'Actions', Frame 1, Line 23 1188: Illegal assignment to class Tween.
感謝錯誤,我知道人們會建議使用TweenLite的,但我想知道的問題是在這裏什麼,否則我不會學習!
感謝,這使得前兩個補間動畫,但後來我得到這個錯誤 類型錯誤:錯誤#1009:無法訪問空對象引用的屬性或方法。 \t在NavigationEquiptment_fla :: ship_mc_3 /幀1() – user1180888
東西是不正確引用,你改變了'myTween05'和'myTween06'以及代碼? –
我沒有在我的函數中使用我的eventlistener,所以它不知道它是什麼引用,噢!非常感謝! – user1180888