Hello,

You could use a Model tag for accessing the xml within your app, and
a Repeater tag to loop through the items and pass their values to
your custom component.  I'm assuming your component has variables
for the category, notes, and date_day xml fields, so code would be
something like the following (Flex 1.5, but should be very similar
in 2.0).  Make sure your app can find the xml file and
CustomComponent.mxml (or whatever you chose to name your custom
component).

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"
width="100%" height="100%">

<mx:Model id="xmlFromFile" source="xml_file.xml"/>

<mx:VBox height="100%" width="100%">
    <mx:Repeater
        id="rp"
        dataProvider="{xmlFromFile.dailly_learning}">
        <CustomComponent
            category="{rp.currentItem.category}"
            notes="{rp.currentItem.notes}"
            date_day="{rp.currentItem.date_day}" />
        </CustomComponent>
    </mx:Repeater>
</mx:VBox>

</mx:Application>


--- In flexcoders@yahoogroups.com, "flexlearner" <[EMAIL PROTECTED]>
wrote:
>
>
>
>  I created a custom component there are some text Areas  in that
> component
>  This component will be imported in main application
>
> My final and simple goal is :
>   To load a xml file --  loop thru the array of
> node  "dailly_learning"
>   And attach the custom component as many as dailly_learning nodes
> are and fill the data into it
> I could have easily done flash using attachmovie but how to do it
in
> Flex
> I could load the xml and could  retrieve the value from it
>
> Some one please guide me !
>
>
>
>
>     Structure of xml files is  something like :
>
> <!---- Xml file -->
>
>  <dailly_learning>
>
>          <category > flex  </category >
>          <notes> some text </notes>
>          <date_day> date <date_day>
>  
> </dailly_learning>
>
> <dailly_learning>
>
>          <category > flash  </category >
>          <notes> some text </notes>
>          <date_day> date <date_day>
>  
> </dailly_learning>
>
> <dailly_learning>
>
>          <category > Misc  </category >
>          <notes> some text </notes>
>          <date_day> date <date_day>
>  
> </dailly_learning>
>
> Regards,
> Flex Learner
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS




Reply via email to