맞춤 구성 요소를 만들지 않고 combobox 하위 (텍스트 입력 및 버튼)에 액세스해야합니다. 가장 좋은 방법은 맞춤 구성 요소를 만드는 것이지만 여전히 textinput과 같은 콤보 상자에 액세스하여 해당 이벤트를 수신해야한다는 것입니다. 어떤 도움이 필요합니까?Flex 콤보 박스 하위 (textInput, button) 액세스
0
A
답변
0
이처럼 콤보 상자 TextInput의 이벤트를 추가 할 수 있습니다
myComboBox.textInput.addEventListener(TextOperationEvent.CHANGE, myFunction);
을 TextInput 구성 개체가 콤보 상자 개체 (myComboBox.textInput)의 자식이기 때문이다.
여기에 전체 작업 예를
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
import spark.events.IndexChangeEvent;
import spark.events.TextOperationEvent;
[Bindable]
private var _dp:ArrayCollection = new ArrayCollection([
{id : "1", name : "Paul"},
{id : "2", name : "Andrew"},
{id : "2", name : "Bob"}
]);
protected function creationCompleteHandler(event:FlexEvent):void
{
myComboBox.textInput.addEventListener(TextOperationEvent.CHANGE, showTextInputValue);
myComboBox.addEventListener(IndexChangeEvent.CHANGE, showComboValue);
}
protected function showTextInputValue(event:TextOperationEvent):void
{
textFieldValue.text = "myComboBox.textInput : " + event.currentTarget.text;
}
protected function showComboValue(event:IndexChangeEvent):void
{
if (event.newIndex > -1)
comboBoxValue.text = "myComboBox selected item is : " + myComboBox.selectedItem.name;
}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:ComboBox id="myComboBox" labelField="name" dataProvider="{_dp}"/>
<mx:Spacer height="100"/>
<s:Label id="textFieldValue"/>
<s:Label id="comboBoxValue"/>
</s:WindowedApplication>
입니다
0
당신은 콤보 상자에 Event.ADDED
에 대한 이벤트 리스너를 추가하고 event.target
확인할 수 있습니다 '지점을 핀의 유형을 원하는 표시 객체 (예 : if (event.target is TextField) doStuff();
) 당신은 콤보 상자에 액세스 할 수 없습니다'속성을 (텍스트 필드를 대체하는 또는 다른 버튼이있는 버튼)을 추가 할 수 있지만 스테이지에 추가 된 인스턴스는 수정할 수 있습니다.
관련 문제
- 1. Flex 모바일 TextInput 이벤트
- 2. 데이터베이스 액세스 및 콤보 박스
- 3. flex 4 콤보 박스 selectedIndex 오류
- 4. 콤보 상자가 느려짐 Flex
- 5. iOS의 Flex 4.6 TextInput 키보드
- 6. Adobe Flex - 쉼표로 어지러운 Textinput
- 7. 스타일 Textinput Flex DataGrid의 ItemRenderer
- 8. maxchars의 flex adaptative textinput 함수
- 9. 하위 폼에 콤보 박스 바인딩하기 Access
- 10. 콤보 박스
- 11. 클래스 속성에 의한 동적 Flex 콤보 박스 생성
- 12. Flex 4.6 AIR 3.2 TextInput 가공물
- 13. Flex TextInput 왼쪽 클릭 - 부모 Steals 포커스
- 14. Flex 4.6의 ActionScript에서 TextInput Dynamical 만들기
- 15. Flex 모바일 응용 프로그램 TextInput 너비 문제
- 16. 스크롤러 텍스트 지연의 Flex Mobile textInput
- 17. Flex TextInput 컨트롤 : 검색 스타일 렌더링
- 18. 데이터 격자보기 콤보 박스
- 19. 콤보 박스 내부의 QIcon
- 20. 자바 스윙 콤보 박스
- 21. 바인딩 콤보 박스
- 22. 소스가 사전에있는 콤보 박스
- 23. django의 동적 콤보 박스
- 24. EXTJS4의 연결된 콤보 박스
- 25. 콤보 박스 값이 자동으로
- 26. 콤보 박스 데이터 입력
- 27. 콤보 박스 항목 스타일
- 28. 첸차 터치의 콤보 박스
- 29. 콤보 박스/DB 오류?
- 30. 자바 스크립트 콤보 박스