2012-10-21 2 views
0

MXML 만 사용하면 요소를 추가하고 제거하는 상태 사이를 전환하는 쉬운 방법이 있습니까? 예를 들어Flex 4 쉬운 방법으로 상태 간 전환

:

<s:Group includeIn="state1"/> 
<s:Group includeIn="state2"/> 

이 전환 예를 들어, 밖으로 상태 1을 밀어에서 상태 2 MXML 수 있습니까?

감사합니다. 여기에 위의 게시 된 링크에 추가

+4

http://livedocs.adobe.com/flex/3/html/help.html?content=transitions_5.html을 확인 도움이 될 수 있습니다 : http://help.adobe.com/en_US/flex /using/WS2db454920e96a9e51e63e3d11c0bf69084-7fab.html? – JeffryHouser

답변

0

여러 대상에 하나의 전환을 적용하는 방법 :

<?xml version="1.0" encoding="utf-8"?> 
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" 
     xmlns:s="library://ns.adobe.com/flex/spark" 
     xmlns:views="views.*" > 

    <s:states> 
     <s:State name="home"/> 
     <s:State name="help"/> 
     <s:State name="instructions"/> 
     <s:State name="settings"/> 
     <s:State name="feedback"/> 
    </s:states> 

    <s:transitions> 
     <s:Transition fromState="*" toState="*" > 
      <s:Sequence > 
       <s:Wipe direction="right" duration="350" target="{this}"/> 
      </s:Sequence> 
     </s:Transition> 
    </s:transitions> 

    <views:Home   id="home"  includeIn="home"   width="100%" height="100%" ownerComponent="{this}"/> 
    <views:Help   id="help"  includeIn="help"   width="100%" height="100%" ownerComponent="{this}" /> 
    <views:Instructions id="instructions" includeIn="instructions" width="100%" height="100%" ownerComponent="{this}" /> 
    <views:Settings  id="settings" includeIn="settings"  width="100%" height="100%" ownerComponent="{this}" /> 
    <views:Feedback  id="feedback" includeIn="feedback"  width="100%" height="100%" ownerComponent="{this}" /> 

</s:Group> 

이전의 전환은 한 방향에서 다른 닦아 만듭니다.

<s:transitions> 
    <s:Transition fromState="*" toState="home" > 
     <s:Sequence > 
      <s:Fade target="{this}" alphaFrom="1" alphaTo="0"/> 
      <s:RemoveAction targets="{[home,help,instructions,settings,feedback]}"/> 
      <s:AddAction target="{home}"/> 
      <s:Fade target="{this}" alphaFrom="0" alphaTo="1"/> 
     </s:Sequence> 
    </s:Transition> 
</s:transitions> 

다음 슬라이드 나머지 부분을 밀면서에서 하나 개의보기 :

<s:transitions> 
    <s:Transition fromState="*" toState="home" > 
     <s:Sequence duration="1000" > 
      <s:Parallel> 
       <s:Move applyChangesPostLayout="true" targets="{notHomeTargets}" xFrom="0" xTo="{-width}"/> 
       <s:AddAction target="{home}" /> 
       <s:Move applyChangesPostLayout="true" target="{home}" xFrom="{width}" xTo="0"/> 
      </s:Parallel> 
      <s:RemoveAction targets="{targets}" /> 
     </s:Sequence> 
    </s:Transition> 
</s:transitions> 

당신은 각각의 상태에 대해 하나를 만들 것

다음 전환은 하나 개의보기에서 다른 페이드 마지막 예.