2013-08-19 4 views
0

내가 사진 갤러리를 만들어, 모든 사진에 와서 시작합니다CS5 AS3 랜덤 엘라스틱을 플래시하는 방법?

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

그리고 그것은 멋진 있지만, 모든 사진은 같은 방법으로 온다면, 그것은 보는 계층 약간이다. 그래서 나는 페이드, 블라인드, 아이리스, 플라이, 디졸브, 스퀴즈, 닦아 내기, 확대/축소, rotationX, 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)]; 
} 

편집 :

내가 문서를 살펴했다 (I는 사용 greensock의 트윈을하는 데는 보통). 다음으로해야합니다 : http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/transitions/Tween.html

코드를 편집했습니다.

+0

안녕하세요,이 새 코드를 사용해 주셔서 감사합니다. 이전에는 내 갤러리에 있었지만이 코드에는 별다른 문제가 없습니다. 출력 : ReferenceError : 오류 # 1056 : Fl.containers.UILoader.at에서 속성 플라이를 만들 수 없습니다. fl.transitions :: Tween/setPosition() fl.transitions :: Tween/set position() \t at fl.transitions :: 트윈() \t index_fla에서 :: wildlifes_mc_25 /는 completeHandler() flash.events::EventDispatcher/dispatchEventFunction()에서 \t flash.events::EventDispatcher/dispatchEvent() fl.containers에서 \t ::하여 UILoader에서 \t/passEvent() \t at fl.containers :: UILoader/handleComplete() – Lily

+0

편집을 참조하십시오. 의사에게 가서 확인해보십시오 ... AS3는 아주 좋은 것을 가지고 있습니다. – djib