각 캔버스 헤더에 버튼을 포함하도록 Adobe Flex Accordion의 스타일을 변경하려면 어떻게 해야 합니까?

StackOverflow https://stackoverflow.com/questions/11665

  •  08-06-2019
  •  | 
  •  

문제

내 아코디언의 샘플 코드는 다음과 같습니다.

<mx:Accordion x="15" y="15" width="230" height="599" styleName="myAccordion">
    <mx:Canvas id="pnlSpotlight" label="SPOTLIGHT" height="100%" width="100%" horizontalScrollPolicy="off">
        <mx:VBox width="100%" height="80%" paddingTop="2" paddingBottom="1"  verticalGap="1">
            <mx:Repeater id="rptrSpotlight" dataProvider="{aSpotlight}">            
                <sm:SmallCourseListItem 
                    viewClick="PlayFile(event.currentTarget.getRepeaterItem().fileID);"
                    Description="{rptrSpotlight.currentItem.fileDescription}"
                    FileID = "{rptrSpotlight.currentItem.fileID}"   
                    detailsClick="{detailsView.SetFile(event.currentTarget.getRepeaterItem().fileID,this)}" 
                    Title="{rptrSpotlight.currentItem.fileTitle}"
                    FileIcon="{iconLibrary.getIcon(rptrSpotlight.currentItem.fileExtension)}" />
            </mx:Repeater>
        </mx:VBox>
    </mx:Canvas>
</mx:Accordion>

다음과 같이 각 헤더에 버튼을 포함하고 싶습니다.

wishful

도움이 되었습니까?

해결책

감사합니다. 다음을 사용하여 작동하게 되었습니다. FlexLib의 CanvasButtonAccordionHeader입니다.

다른 팁

사용자 정의 헤더 렌더러를 생성하고 여기에 버튼을 추가한 후 수동으로 위치를 지정해야 합니다.다음과 같이 시도해 보십시오:

<mx:Accordion>
    <mx:headerRenderer>
        <mx:Component>
            <AccordionHeader xmlns="mx.containers.accordionClasses.*">
                <mx:Script>
                <![CDATA[

                import mx.controls.Button;


                private var extraButton : Button;


                override protected function createChildren( ) : void {
                    super.createChildren();

                    if ( extraButton == null ) {
                        extraButton = new Button();

                        addChild(extraButton);
                    }
                }

                override protected function updateDisplayList( unscaledWidth : Number, unscaledHeight : Number ) : void {
                    super.updateDisplayList(unscaledWidth, unscaledHeight);

                    extraButton.setActualSize(unscaledHeight - 6, unscaledHeight - 6);
                    extraButton.move(unscaledWidth - extraButton.width - 3, (unscaledHeight - extraButton.height)/2);
                }

                ]]>
                </mx:Script>
            </AccordionHeader>
        </mx:Component>
    </mx:headerRenderer>

    <mx:HBox label="1"><Label text="Text 1"/></HBox>
    <mx:HBox label="1"><Label text="Text 2"/></HBox>
    <mx:HBox label="1"><Label text="Text 3"/></HBox>
</mx:Accordion>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top