2013-08-19 48 views
0

我做了一個圖片庫,每一張照片開始進來:如何Flash CS5 AS3隨機彈性?

new Tween(uiLoader,"rotationX",Elastic.easeOut,90,0,4,true); 

而且這很酷,但如果所有的照片都以同樣的方式,它是分層看它一點。所以我想問這裏的任何代碼,使其隨着淡入淡出,百葉窗,虹膜,飛,溶解,擠壓,擦拭,縮放,旋轉X,Elastic.easeOut?這裏是我的代碼:

function completeHandler(event:Event):void 
{ 
    uiLoader.x = (back.width - uiLoader.content.width) >> 1; 
    uiLoader.y = (back.height - uiLoader.content.height) >> 1; 
    new Tween(uiLoader,"rotationX",Elastic.easeOut,90,0,4,true); 
} 

回答

0

這樣的事情?

var properties:Array = ['rotationX', 'rotationY', 'rotationZ', 'rotation']; 
var eases:Array = [Elastic.easeIn, Elastic.easeInOut, 
    Elastic.easeOut, Bounce.easeIn, Back.easeOut]; 

function completeHandler(event:Event):void 
{ 

    uiLoader.x = (back.width - uiLoader.content.width) >> 1; 
    uiLoader.y = (back.height - uiLoader.content.height) >> 1; 
    new Tween(mc, getRandom(properties), getRandom(eases), 90, 0, 4, true); 
} 
function getRandom(array:Array):* 
{ 
    return array[Math.floor(Math.random() * array.length)]; 
} 

編輯:

我看看DOC(我usualy使用GreenSock的補間)。您應該: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/transitions/Tween.html

我編輯了代碼。

+0

嗨,感謝這個新代碼,我過去了我的畫廊,但這裏的代碼沒什麼問題。 OUTPUT: ReferenceError:錯誤#1056:無法在fl.containers.UILoader.at上創建屬性fl.transitions :: Tween/setPosition()fl.transitions :: Tween/set位置() \t at fl.transitions ::吐溫() \t在index_fla :: wildlifes_mc_25 /在completeHandler() \t在flash.events::EventDispatcher/dispatchEventFunction() \t在flash.events::EventDispatcher/dispatchEvent() \t在fl.containers ::的UILoader/passEvent() \t at fl.containers :: UILoader/handleComplete() – Lily

+0

請參閱編輯。去檢查文件... AS3有一個非常好的。 – djib