You don't have an array - all you have is a string. You need to convert
it to an array. Try this:

<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the ComboBox control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
     creationComplete='test()'>
     <mx:Script>
         <![CDATA[
             import mx.collections.ArrayCollection;
             import mx.controls.Alert;
             import mx.utils.ArrayUtil;

             [Bindable] private var cards:ArrayCollection;

             private function test():void
             {
                 cards = new ArrayCollection(green.text.split(","));
             }
         ]]>
     </mx:Script>
     <mx:Panel title='ComboBox Control Example' layout='horizontal'
         paddingTop='10' paddingBottom='10' paddingLeft='10'
paddingRight='10'>
         <mx:ComboBox dataProvider='{cards}' />
         <mx:VBox>
             <mx:Text id='green' color='green'
text="M3-02-06-2010-10-05-04.flv,M3-02-06-2010-22-17-16.flv,M3-02-06-201\
0-12-07-06.flv,M3-02-06-2010-08-03-02.flv"/>
         </mx:VBox>
     </mx:Panel>
</mx:Application>



--- In flexcoders@yahoogroups.com, cholid cholid <cholid_rid...@...>
wrote:
>
> hi all
> i've new problem
>
> im make mx:ComboBox that the data is from array that's request from
mx:Text
>
> i've two mx:Text that string source is
>
> 1.array string =
>
> ['M3-02-06-2010-10-05-04.flv', 'M3-02-06-2010-22-17-16.flv',
'M3-02-06-2010-12-07-06.flv', 'M3-02-06-2010-08-03-02.flv']
>
> 2.array string that source is from external fungtion (call with https)
>
> THE PROBLEM IS:
> if i call array from second mx:Text, the mx:ComboBox is not show data
> but if i call array from first, the mx:ComboBox is not working
>
> the source code is here:
>
> <?xml version='1.0'?>
> <!-- Simple example to demonstrate the ComboBox control. -->
> http://www.adobe.com/2006/mxml' creationComplete='test()'>
> <mx:HTTPService id='combolist' url='combolist' />
>  <mx:Script>
>   <![CDATA[
>    import mx.collections.ArrayCollection;
>    import mx.controls.Alert;
>    import mx.utils.ArrayUtil;
>    [Bindable]
>    private var cards:ArrayCollection;
>    private function test():void
>    {
>     combo = new ArrayCollection( ArrayUtil.toArray( String(green.text)
) );
>    }
>   ]]>
>  </mx:Script>
>
>  <mx:Panel title='ComboBox Control Example'
>   layout='horizontal'
>   paddingTop='10' paddingBottom='10' paddingLeft='10'
paddingRight='10'>
>
>   <mx:ComboBox dataProvider='{combo}' />
>
>   <mx:VBox>
>    <mx:Text  id='green' color='green'
text="['M3-02-06-2010-10-05-04.flv', 'M3-02-06-2010-22-17-16.flv',
'M3-02-06-2010-12-07-06.flv', 'M3-02-06-2010-08-03-02.flv']"/>
>                         <mx:Text  id='red' color='red'
text="{combolist}"/>
>
>   </mx:VBox>
>
>  </mx:Panel>
> </mx:Application>
>

Reply via email to