Flex combox 테스트
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
minWidth="955"
minHeight="600" creationComplete="init()">
<fx:Declarations>
<!-- ( 、 ) -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.collections.IList;
import mx.collections.XMLListCollection;
import mx.controls.Alert;
[Bindable]
private var monitorItemData:XML=<root>
<node label=" " type="0">
<item label="apache" value="1"/>
<item label="loadbalance" value="2"/>
</node>
<node label=" " type="0">
<item label="apusic" value="1"/>
<item label="tomcat" value="2"/>
<item label="weblogic" value="3"/>
</node>
<node label=" " type="0">
<item label="mysql" value="1"/>
<item label="db2" value="2"/>
<item label="oracle" value="3"/>
</node>
</root>;
var data:ArrayCollection = new ArrayCollection();
var provider:ArrayCollection;
var xmlListCollection:XMLListCollection = new XMLListCollection();
var selectedVm:String;
var selectedSpecifyItem:String;
var obj:Object;// comboBox
private function init():void{// XML ArrayCollection
xmlListCollection = new XMLListCollection(monitorItemData.children());
data.source = xmlListCollection.toArray();
// ( ?)
// var xmlList:XMLList = new XMLList();
// xmlList = monitorItemData.elements("node");
// xmlListCollection.source = xmlList;
// var myData:ArrayCollection = new ArrayCollection(xmlListCollection.toArray());
}
private function vmChangeHandler(e:Event):void{
var xmlListCollection:XMLListCollection = new XMLListCollection();
xmlListCollection.source = e.target.selectedItem.item;// XMLList XMLListCollection
provider = new ArrayCollection(xmlListCollection.toArray());
specifyItem.dataProvider = provider;
//specifyItem.selectedIndex=0; comboBox
selectedVm = e.target.selectedItem.@label;
specifyItem.selectedIndex = -1;
}
private function specifyItemChangeHandler(e2:Event):void{
selectedSpecifyItem = specifyItem.selectedItem.@label;
yourSelect.text=selectedVm+selectedSpecifyItem;
}
]]>
</fx:Script>
<s:Group width="30%" height="45%" x="153" y="33">
<s:Panel title=" " width="482" height="100%">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:Group width="100%" height="20%">
<s:Label text=" :" id="vm" x="33" y="6"/>
<s:ComboBox x="109" y="1" width="124" id="vmCombox" labelField="@label" dataProvider="{data}" change="vmChangeHandler(event)"/>
<s:Label x="250" y="6" text=" :" id="monitorItem"/>
<s:ComboBox x="311" y="1" width="124" id="specifyItem" labelField="@label" change="specifyItemChangeHandler(event)" />
</s:Group>
<s:Line width="100%" height="2">
<s:stroke>
<s:SolidColorStroke color="0x000000" weight="2"/>
</s:stroke>
</s:Line>
<s:Group width="100%" height="66%" id="drop">
<s:Label text=" :" id="selectedItems" x="10" y="0"/>
<s:List height="153" width="161" x="105" y="0">
</s:List>
<s:Button label=" " x="278" y="34"/>
<s:Button x="277" y="83" label=" " id="dropAll"/>
</s:Group>
<s:Line width="100%" height="2">
<s:stroke>
<s:SolidColorStroke color="0x000000" weight="2"/>
</s:stroke>
</s:Line>
<s:Group width="100%" height="14%">
<s:Button label=" " x="308" y="-4" id="submit"/>
<s:Button x="400" y="-4" label=" " id="cancel"/>
<s:Label x="38" y="-1" text=" :"/>
<s:Label x="128" y="0" id="yourSelect"/>
</s:Group>
</s:Panel>
</s:Group>
</s:Application>
—————————————————————— ————————————
:
1、 init() ?
2、 vmChangeHandler specifyItem.selectedIndex=0
3、 comboBox tree
—————————————— ——————————————
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
creationComplete="init()">
<s:layout>
<s:BasicLayout/>
</s:layout>
<fx:Declarations>
<!-- ( 、 ) -->
<fx:XML id="xmlPC_linked" source="PC_linked.xml"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.collections.XMLListCollection;
var xmlListCollection:XMLListCollection = new XMLListCollection();
var data:ArrayCollection;// = new ArrayCollection();
var xmlList:XMLList = new XMLList();
public function init():void{
//xmlListCollection = new XMLListCollection(xmlPC_linked.children());
//data.source = xmlListCollection.toArray();
xmlList = xmlPC_linked.elements("node");
xmlListCollection.source = xmlList;
data = new ArrayCollection(xmlListCollection.toArray());
}
public function changeHandler(e:Event):void
{
//showSelectedItem.text = ComboBox(e.target).selectedItem.node.label;
city.dataProvider=e.target.selectedItem.item;
city.selectedIndex=0;
}
]]>
</fx:Script>
<s:Panel x="262" y="144" width="296" height="200">
<s:ComboBox id="pro" dataProvider="{data}" labelField="@label" change="changeHandler(event)"/>
<s:ComboBox id="city" labelField="@label"/>
</s:Panel>
</s:Application>
mxml xml , 。 mxml flex3 ... ...
... ...
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
XML이란 무엇입니까?이것은 저장, 검색 및 공유할 수 있는 형식으로 데이터를 저장하는 강력한 방법입니다. 가장 중요한 것은 XML의 기본 형식이 표준화되어 있기 때문에 시스템이나 플랫폼 간에 로컬 또는 인터넷을 통해 XML을 공유하거나...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.