我在圖書館裏有幾個動畫片段,我想製作將它們加載到舞臺上的功能。我的問題是我找不到爲每個MovieClip製作單獨的函數的不同解決方案。我正在尋找類似的東西:如何從庫中動態添加對象?
function addAnyClip(name){
//create new object 'name'
stage.addChild(chosenObject);
rest of code
}
,因爲它是優於:
function addClip1(){
var mc1:Clip1 = new Clip1;
stage.addChild(mc1);
///rest of code
}
function addClip2(){
var mc1:Clip2 = new Clip2;
stage.addChild(mc2);
///rest of code
}
function addClip3(){
var mc1:Clip3 = new Clip3;
stage.addChild(mc3);
///rest of code
}
...
非常感謝你:) –
歡迎你!快樂的編碼..哦,並且將這個答案標記爲你想要的答案,如果你願意的話! –