2012-12-02 4 views
0

다음 응용 프로그램을 실행할 때 내 Scroller은 내부 그룹의 높이만큼 늘어납니다. 내 창은 같은 크기로 그것을 싶습니다플렉스의 이상한 Scroller 동작

enter image description here

: 여기

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009"> 
    <s:Scroller width="100%" height="100%" verticalScrollPolicy="on"> 
     <s:Group height="1400"/> 
    </s:Scroller> 
</s:Application> 

내가 무엇을 얻을 수 있습니다. 설명해 주시겠습니까? 내가 뭘 잘못하고 있니? Scroller이 뷰포트로 사용되는 이유는 무엇입니까?

답변

1

일반적으로 스크롤러의 높이/너비를 명시 적 값으로하고 어린이의 높이/너비를 백분율로 만들려고합니다. 당신은 그 반대로했습니다. 그래서,이 같은 : 그러나

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009"> 
    <s:Scroller width="100%" height="1400" verticalScrollPolicy="on"> 
     <s:Group height="100%"/> 
    </s:Scroller> 
</s:Application> 

, 그 스크롤러/그룹에 사용 가능한 윈도우의 폭을 만드는 문제가 해결되지 않습니다. updateDisplayList() 메서드의 요소 크기를 조정하면됩니다.

<?xml version="1.0" encoding="utf-8"?> 
    <s:Application xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009"> 
<fx:Script> 
    protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number:void{ 
    super.updateDisplayList(unscaledWidth, unscaledHeight); 
    myScroller.width = unscaledWidth; 
    myScroller.height - unscaledHeight; 
    mySCrollingGroup.width = unscaledWidth 
    mySCrollingGroup.height - unscaledHeight; 
    } 
</fx:Script> 

     <s:Scroller verticalScrollPolicy="on" id="myScoller"> 
      <s:Group id="mySCrollingGroup" /> 
     </s:Scroller> 
    </s:Application> 

스크롤 막대의 높이/너비에 맞게 myScrollingGroup의 크기를 조정할 수 있습니다. 또는 myScrollingGroup에서 precentHeight/percentWidth 속성을 사용하고 100 %로 설정할 수 있습니다.

+0

감사합니다. updatedDisplayList 함수에서 myScroller.percentHeight를 설정할 때 부드럽게 작동했습니다! –