@Shaleen

The error you have mentioned is actually not an error. Flex compiler
gives you a compile time error when you try to do something like this

myData = event.result

because result is defined as an object type.
But if you write something like event.result.img.src then compiler
itself doesn't know about the data type of img.src therefore it does
not throw error at compile time. And as soon as u are sure of the data
type of event.result.img.src you need not to typecast it into some
data type.

In the KKH's case event.result.img.src is coming out as
ArrayCollection itself so he doesn't actually requires to type cast it
again in ArrayCollection.

HTH,

-Ravi

On Apr 15, 1:12 am, Shaleen Jain <[email protected]> wrote:
> Ist error in this piece of code
>
>  [Bindable]
>     private var myData:ArrayCollection;
>
>     private function resultHandler(event:ResultEvent):void
>     {
>               myData = event.result.img.src;
>     }
>
> you forget to make the instance of the arrycollection
> Second you didn't parse event.result.img.src into arraycollection
>
> The correct code is
> [Bindable]
>                 private var myData:ArrayCollection;
>
>                 private function resultHandler(event:ResultEvent):void
>                 {
>                         myData = new ArrayCollection();
>                         myData = event.result.img.src as ArrayCollection;
>                 }
>
> Second there is no method like getListItems which you are trying to
> access.
> Instead you should use getItemAt(indexValue);
>
> HTH
>
> Thanks,
> Shaleen Jainhttp://shaleenjain.blogspot.com
>
> On Apr 6, 5:21 pm, Ravi Mishra <[email protected]> wrote:
>
> > set a breakpoint on the resultHandler function and check what
> > event.result is returning. This will help you.
>
> > -Ravi
>
> > On Apr 6, 4:21 pm, KKH <[email protected]> wrote:
>
> > > Hi Friends,
>
> > > I am new comer in flex. i have one dought . how to get the list of
> > > value and dispaly it from the xml file. plz verify following prg
> > > correct or not
>
> > > this is Mxml:
>
> > > <?xml version="1.0" encoding="utf-8"?>
> > >  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> > >  backgroundGradientColors="[0xFFFFFF, 0xAAAAAA]"
> > > horizontalAlign="left"
> > >  verticalGap="15" horizontalGap="15"  initialize="myService.send()">
> > >     <mx:Script>
> > >     <![CDATA[
> > >     import mx.collections.ArrayCollection;
> > >     import mx.rpc.events.ResultEvent;
>
> > >     [Bindable]
> > >     private var myData:ArrayCollection;
>
> > >     private function resultHandler(event:ResultEvent):void
> > >     {
> > >               myData = event.result.img.src;
> > >     }
>
> > >     ]]>
> > >     </mx:Script>
>
> > >     <mx:HTTPService id="myService"    url="assets/img_path.xml"
> > > result="resultHandler(event)"/>
>
> > >    <mx:Text id="something" text="{myData.getListItems.path}"
> > > enabled="true" visible="true"/>
>
> > >    <mx:Image id="myimg" source="{myData.getListItems.path}" />
>
> > >    <!-- <mx:Text id="something" text="{myData.getItemAt
> > > (0).path}"
> > > enabled="true" visible="true"/>
>
> > >       <mx:Image id="myimg1" source="{myData.getItemAt(0).path}" /> --
>
> > > </mx:Application>
>
> > > Xml:
>
> > > <?xml version="1.0" encoding="utf-8"?>
> > > <img>
> > >         <src>
> > >                         <path>assets/1.png</path>
> > >         </src>
> > >         <src>
> > >                         <path>assets/2.png</path>
> > >         </src>
> > >         <src>
> > >                         <path>assets/3.png</path>
> > >         </src>
> > > </img>
>
> > > Thanks & Regards
> > > KKH
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to