Here is my situation,

I have a combobox and a viewstack. The combobox's dataProvider is XML
generated by a php script retrieving information from a db.

The database has two primary entries. The first is a location, the
second is a type of test performed. These are inputed by the user
elsewhere in the application. When the user views the combobox, they
see the list of site entries.

Upon selecting the a site, the viewstack should change to show the
related test information. Should be pretty straight forward. The
problem comes when I want to pass the string value of the test to
viewstack - they have the same names.

As a test of the viewstack, this works fine:
dataProvider="{viewstackTestKits.getChildren()}"
change="{viewstackTestKits.selectedChild=event.currentTarget.selectedItem}"

But I want something like this:
change="viewstackTestKits.selectedChild=box.selectedItem.Test_Kit_Used"


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
        creationComplete="service.send()">
        
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
                                        
                                        
[Bindable]
private var samplepoint:ArrayCollection
                                        
[Bindable]
private var currentSlide:Object;
                                        
private function SPresultHandler(event:ResultEvent):void
{
samplepoint = event.result.response.data.row;
}
                                        
private function getListLabel(item:Object):String
{                                       
return item.Sample_Point_Name; 
}
private function changeHandler(event:Event):void
{
currentSlide = box.selectedLabel;
}
]]>
</mx:Script>
                        
<mx:HTTPService id="service"
                                url="Define_Sample_Points.php?method=FindAll"
result="SPresultHandler(event)"/>
      
<mx:ComboBox id="box" dataProvider="{samplepoint}"
labelFunction="getListLabel"
change="changeHandler(event)" x="52" y="27">
</mx:ComboBox>
        
                
<mx:Text id="lbl" text="{box.selectedItem.Test_Kit_Used}" />    
                        
                                
</mx:Application>

Reply via email to