Adobe Dreamweaver Forums



Last 10 THreads :         problems linking PDFs (Last Post : Mantzi - Replies : 0 - Views : 1 )           »          flash loader reappears after movie plays (Last Post : lyshamo - Replies : 3 - Views : 4 )           »          cfimage error (Last Post : -==cfSearching==- - Replies : 1 - Views : 2 )           »          How to turn IMAGE into MOVIECLIP??? (Last Post : Snufferson - Replies : 7 - Views : 8 )           »          Embed files in a projector (Last Post : ytlevine - Replies : 0 - Views : 1 )           »          ColdFusion = "old technology" (Last Post : Ian Skinner - Replies : 7 - Views : 8 )           »          Load dynamic text into an embeded swf (Last Post : mikeyjray - Replies : 4 - Views : 9 )           »          Log email text (Last Post : Torgom - Replies : 0 - Views : 1 )           »          Properties > Flex Build Path (Last Post : kevxross - Replies : 0 - Views : 1 )           »          Can Anyone Help With Sub Menus (Last Post : Murray *ACE* - Replies : 8 - Views : 9 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-21-2008, 05:17 AM
ironblunt
 
Posts: n/a
Diggs:
Default Best way to communicate between custom components

Hi all,

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 file.

So I looked through some books and several other online sites and I think
there are 3 strategies but some are less elegant than others.

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.

Thanks

spark




Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-21-2008, 06:14 AM
SujitG
 
Posts: n/a
Diggs:
Default Re: Best way to communicate between custom components

Hi,

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 places.

Hope this helps.

Reply With Quote
  #3 (permalink)  
Old 11-21-2008, 02:43 PM
Amy Blankenship
 
Posts: n/a
Diggs:
Default Re: Best way to communicate between custom components


"ironblunt" <webforumsuser@macromedia.com> wrote in message
news:gg5g92$ftj$1@forums.macromedia.com...
> Hi all,
>
> 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.


Look at the answer to Q3 here:
http://www.magnoliamultimedia.com/fl...s_Flex_FAQ.pdf

It more focuses on communication up from the components to the application,
but the links apply to your situation as well.

Also, check out the terms "getter" and "setter" in the Help. Also look up
the word "binding."

HTH;

Amy


Reply With Quote


Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 11:31 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Cheap Car Insurance - Compare Motor Insurance
Endsleigh Car Insurance Natwest Car Insurance
More Than Car Insurance Norwich Union Car Insurance
Prudential Car Insurance Zurich Car Insurance
Inactive Reminders By Mished.co.uk