2010-02-25 2 views
2

xml 파일에서 horizontalList 구성 요소를 채우려는 경우 너비 값은 모든 데이터뿐만 아니라 xml 파일에도 포함됩니다.Horizontallist 가변 폭

실제로이 코드가 있습니다

<mx:Model id="epg" source="epg.xml" /> 

<mx:Component id="customRend"> 
    <mx:Label text="{data.description}" width="{data.width}"/> 
</mx:Component> 

<mx:HBox x="82" y="104" width="1203" height="113" verticalAlign="middle"> 
    <mx:HorizontalList width="100%" dataProvider="{epg.channel.program}" 
     itemRenderer="{customRend}" horizontalScrollPolicy="off"> 
    </mx:HorizontalList> 
</mx:HBox> 

을하지만, 목록에있는 모든 요소에 같은 폭을 설정합니다.

이 작업을 수행하는 방법을 알고 계십니까?

고마워요. 브롬

답변

0

두이 작업을 수행하는 방법 : 캔버스

creationComplete

  • 랩 라벨에의 creationComplete 방법을 (? 아마 itemRenderer를이 컨테이너해야하기 때문에) label.width = data.width을 설정

    • 를 :

      <mx:HorizontalList width="100%" dataProvider="{epg.channel.program}" horizontalScrollPolicy="off"> 
          <mx:itemRenderer> 
           <mx:Component id="customRend"> 
            <mx:Label text="{data.description}" creationComplete="this.width = data.width"/> 
           </mx:Component> 
          </mx:itemRenderer> 
      </mx:HorizontalList> 
      

      ... 또는 w 캔버스에 두드려 : 도움이

      <mx:HorizontalList width="100%" dataProvider="{epg.channel.program}" horizontalScrollPolicy="off"> 
          <mx:itemRenderer> 
           <mx:Component id="customRend"> 
            <mx:Canvas horizontalScrollPolicy="off"> 
             <mx:Label text="{data.description}" width="{data.width}"/> 
            </mx:Canvas> 
           </mx:Component> 
          </mx:itemRenderer> 
      </mx:HorizontalList> 
      

      희망, 랜스 도와

  • +0

    감사합니다. 나는이 코드를 시도했지만 여전히 같은 문제가 있습니다. 너비는 항상 모든 요소에 대해 동일하지만, 나는 이것에 대해 아무런 힌트가 없다 :-( –

    +0

    어떤 플렉스 버전을 사용하고 있는가? 나를 위해 일하고있다. –

    +0

    플렉스 빌더 3, 내가 구현하고 싶은 것은 무언가이다. 이 http://jaganath.files.wordpress.com/2006/12/guide.PNG와 같은, 아마도 내가 사용할 수있는 다른 쉬운 구성 요소가 ... –