我有下面的代碼,它基本上是跨屏幕動畫對象,當發生翻轉時它暫停動畫,並顯示一些信息。一切工作正常,但當它暫停時,我會像當前對象一樣'頂部',所以其他項目落後。將對象帶到前面,在Flash AS3
我看了一下setChildIndex,但沒有多少運氣。
package {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.events.KeyboardEvent;
import flash.events.*;
import caurina.transitions.Tweener;
import fl.motion.Color;
public class carpurchase extends Sprite {
public function carpurchase() {
var carX = 570;
//Set cars
var car1:fullCar = new fullCar();
car1.info.alpha = 0;
//var c:Color = new Color();
//c.setTint(0xff0000, 0.8);
//car2.car.transform.colorTransform=c;
car1.x = carX;
car1.y = 280;
car1.info.title.text = "test";
car1.info.desc.text = "test";
addChild(car1);
car1.addEventListener(MouseEvent.ROLL_OVER, carPause);
car1.addEventListener(MouseEvent.ROLL_OUT, carContinue);
function car1Reset():void {
Tweener.addTween(car1, {x:carX, time:0, onComplete:car1Tween});
}
function car1Tween():void {
Tweener.addTween(car1, {x:-120, time:2, delay:3, transition:"linear", onComplete:car1Reset});
}
car1Tween();
var car2:fullCar = new fullCar();
car2.info.alpha = 0;
var c:Color = new Color();
c.setTint(0xff0000, 0.8);
car2.car.transform.colorTransform=c;
car1.x = carX;
car2.y = 175;
car2.info.title.text = "test";
car2.info.desc.text = "test";
addChild(car2);
car2.addEventListener(MouseEvent.ROLL_OVER, carPause);
car2.addEventListener(MouseEvent.ROLL_OUT, carContinue);
function car2Reset():void {
Tweener.addTween(car2, {x:carX, time:0, onComplete:car2Tween});
}
function car2Tween():void {
Tweener.addTween(car2, {x:-120, time:3, delay:0, transition:"linear", onComplete:car2Reset});
}
car2Tween();
function carPause(e:MouseEvent):void {
Tweener.pauseTweens(e.target);
Tweener.addTween(e.target.info, {y:-150, alpha:1, time:.5, transition:"easeout"});
}
function carContinue(e:MouseEvent):void {
Tweener.addTween(e.target.info, {y:10, alpha:0, time:.5, transition:"easeout"});
Tweener.resumeTweens(e.target);
}
}
}
任何幫助,歡迎
我也有同樣問題的任何幫助將非常apreciated! setChildIndex(evento.target,numChildren - 1);這不工作,它標誌着這個錯誤:場景1,圖層'行動',第1幀,第6行\t 1084:語法錯誤:期待rightparen之前1. – 2011-12-31 00:56:10