2010-01-11 2 views
1

그룹을 뷰포트로 제어하는 ​​사용자 정의 스크롤바가 있습니다. 해당 그룹의 내용이보기보다 크지 때 그 스크롤 자동 숨기기를 만들고 싶어AutoHiding 사용자 정의 스크롤 막대 플렉스 4

<s:HGroup> 
     <s:Group width="520" height="380" clipAndEnableScrolling="true" id="descriptionBox" > 
      <s:RichText text="Test Test Test Test Test Test Test " 
         width="490" textAlign="justify" fontFamily="Arial" fontSize="12" color="#999999" /> 
     </s:Group> 
     <s:VScrollBar viewport="{descriptionBox}" 
       left="{descriptionBox.x + descriptionBox.width + 10}" 
       top="10" 
       height="{descriptionBox.height}" 
       fixedThumbSize="true" 
       skinClass="VScrollBarSkin"/> 
    </s:HGroup> 

, 일반적으로 (I 뷰포트 그룹 내부의 구성 요소에 의존 싶지 않는 것을 의미한다) 그렇게하는 방법을 어떤 생각 ?

감사합니다.

플렉스 4

답변

1

스크롤러 구성 요소는 정확히 수행 :

  • 당신이 피부를 통해 스크롤 막대를 사용자 정의 할 수있는 GroupBase (IViewports있는 그룹 또는 DATAGROUP)에 수평 및 수직 스크롤 막대를 표시/Autohides

    <s:Application 
        xmlns="http://ns.adobe.com/mxml/2009" 
        xmlns:s="library://ns.adobe.com/flex/spark" 
        xmlns:mx="library://ns.adobe.com/flex/mx"> 
    
        <Script> 
         <![CDATA[ 
    
          private var times:int = 400; 
    
          private function updateText(type:String):void 
          { 
           var newText:String = ""; 
           var i:int = 0; 
           var n:int = times; 
           for (i; i < n; i++) 
           { 
            newText += "Test "; 
           } 
           var text:String = richText.text; 
           if (type == "add") 
            text += newText; 
           else 
            text = newText.replace(text) + ''; 
           richText.text = text; 
          } 
    
         ]]> 
        </Script> 
        <s:HGroup> 
         <s:Button label="+" click="updateText('add')"/> 
         <s:Button label="-" click="updateText('remove')"/> 
        </s:HGroup> 
        <s:Scroller width="520" height="380" id="scroller" minViewportInset="1" focusEnabled="false"> 
         <s:Group clipAndEnableScrolling="true" id="descriptionBox"> 
          <s:RichText id="richText" creationComplete="updateText('add')" 
           width="490" textAlign="justify" fontFamily="Arial" fontSize="12" color="#999999" /> 
         </s:Group> 
        </s:Scroller> 
    </s:Application> 
    
    : 여기

는 설명하고 일을 할 것입니다 코드입니다

그룹에 명시적인 너비/높이를 추가하지 않으려는 것은 자녀의 크기에 달려 있기 때문입니다. Scroller에서 랩핑하면, 모든 세부 사항을 처리합니다.

해당 요소의 그래픽을 사용자 정의하려면 VScrollBarSkin, VScrollBarThumb, VScrollBarTrack 등을 체크 아웃 할 수 있습니다. Horizontal ScrollBar를 사용하지 않으려는 경우 MyScrollerSkin 클래스에 포함 할 수 없습니다. 도움이

희망, 랜스

+0

안녕하세요, 감사는 응답을, 나는 거기에 코드를 참조 해달라고? – shipmaster

+0

그게 해결 되었습니까? –

+0

예, 감사합니다. – shipmaster

관련 문제