You'll need to strip unwanted characters...

cards = new ArrayCollection(green.text.replace(/[\[\]']/g,
"").split(","));


--- In [email protected], cholid cholid <cholid_rid...@...>
wrote:
>
>
>
> but data i've is use '[]'
> when it split with ',' it doesn't work
>
>
>
>
> ________________________________
> From: valdhor valdhorli...@...
> To: [email protected]
> Sent: Wed, June 16, 2010 1:39:54 AM
> Subject: [flexcoders] Re: what's happen with my 'array' ?
>
>
> 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:ArrayCollecti on;
>
>             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-2010- 12-07-06.
flv,M3-02- 06-2010-08- 03-02.flv" />
>         </mx:VBox>
>     </mx:Panel>
> </mx:Application>
>
>
>
> --- In flexcod...@yahoogro ups.com, cholid cholid <cholid_ridwan@ ...>
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:ArrayCollecti on;
> >    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