Just started using flex in the past couple of weeks and while
I think I have the hang of the basic stuff, I wanted to move onto a
more realistic project and ran into some confusion.
Basically, I have an app that will load up an XML file and
has a bunch of custom components. What I'd like to do is load up
the XML file in the main application and have the results of the
parsed XML available to all the custom components.
So if I have a combo box in one of my custom components, I
would like for it to get it's dataprovider from the reloaded XML
So I looked through some books and several other online sites
and I think there are 3 strategies but some are less elegant than
1) My first inclination is to trigger an XMLFileLoaded event
when the application loads or reloads the xml file and have that
event dispatched and add handlers to all my custom components to
deal with the reloaded xml in it's own way. I'm having some
difficulties here in that the application initialize event seems to
dispatch before my custom component's preinitialization gets called
so my event handlers aren't being registered in time for the first
load of the XML file.
2) My second one is to maintain a view state. This is
something that's a bit new to me so I'm not sure how to use it or
if it was meant to maintain an internal state of the app or just
the user interface level stuff.
3) reset the desired data in all the components. and manually
propogate the event down the component hierarchy.
Anyone with more experience on how best to handle such a
case, I'd really appreciate any advice.
I would have created a VO (AS class) which is a singleton and
create a variable which is Bindable and has the result of the
parsed XML file. In my custom components i would have bound the
components to the Bindable variable in the singleton VO created.
This was marking your variable as Bindable will handle
notifying all the bound components when the data changes. As the VO
is singleton, you need not worry about multiple instances being
created or making sure only one instance of the VO is used in all
"ironblunt" <email@example.com> wrote in
> Hi all,
> Just started using flex in the past couple of weeks and
while I think I
> the hang of the basic stuff, I wanted to move onto a
> project and
> ran into some confusion.