2011-10-03 28 views
2

這是我想要實現的,但我不記得AS2中的語法,如果有人可以請幫助。如何附加數字到影片剪輯

public function highlightCan() { 
    var glowId = String(this); 
    var newId = glowId.substring(47); 
    trace ("newId : " + newId); 
    new Tween(_parent._glow["newId"], "_alpha",  
    mx.transitions.easing.None.easeNone, _parent._glow0._alpha, 100, 2, false); 
} 

newId,就是我想要附加到_glow。

如果我硬編碼這個值,即_glow0或_glow1,這個工作,但這個值需要是動態的,爲了得到翻轉狀態工作。每highlightCan();

感謝

回答

0

public function highlightCan(id:Number) {

var glowId = String(this); 
    var newId = glowId.substring(47); 
    trace ("newId : " + newId); 
    new Tween(_parent._glow["newId"], "_alpha",  
    mx.transitions.easing.None.easeNone, 

eval("_parent._glow"+id)._alpha, 100, 2, false); }

當你調用 highlightCan()必須發送

ID number例如爲:highlightCan(2)將使轉換_parent._glow2._alpha

+0

謝謝氨基。這有幫助! – SixfootJames