(BTW sorry all for the duplicate message; it looked like the first one
didn't go through on my side so I did a resend )
Hmm, interesting thought... I do have a singleton in place to track the
user login. I could place a bindable variable there to trigger a view
update. I was trying stay away from the global variable argument.
When you say re-dispatch the event; are you saying to do another
dispatchevent( new event("evtAddedNewContact"); ? Or should I fire a
different event? Would that trigger the parent to react to the event
over and over in a loop?
Thanks!
sj
________________________________
From: [email protected] [mailto:[email protected]] On
Behalf Of Tracy Spratt
Sent: Monday, March 23, 2009 1:11 PM
To: [email protected]
Subject: {Disarmed} RE: [flexcoders] watching and triggering events
Have the parent re-dispatch the event and listen for it in "listAndshow"
One way to handle issues like this it to have a central bindable data
model. A 'singleton" is often used for this. Any component anywhere in
the app that needs to react when some data value changes can listen to
the model, either by binding for simple values, or by using a
changeWatcher if some action needs to occur.
The data service call result handler (which can be in the model) will
set the appropriate model property, and the child components will
respond.
Tracy Spratt,
Lariat Services, development services available
________________________________
From: [email protected] [mailto:[email protected]] On
Behalf Of Scott
Sent: Monday, March 23, 2009 12:29 PM
To: [email protected]
Subject: [flexcoders] watching and triggering events
I think I'm making this more difficult than it should be; or at least I
hope I am...
I've got a parent viewer called AddContactandReminder.mxml and that has
two child objects, AddContact.mxml and ListAndShowContacts.mxml.
When I add a new contact in the contact object I trigger an event
evtAddedNewContact which is watched in the parent object and triggers
the AddContact window to close. I also want it to trigger the
ListAndShowContacts.mxml to reload the contacts from the server and
display the new list. However, since it's another child object at the
same level as the AddContact.mxml I can't see the evtAddedNewContact
fire.
Is there an easy way to watch this event from ListAndShowContacts?
Thanks!
--
This message has been scanned for viruses and
dangerous content by MailScanner <http://www.mailscanner.info/> , and is
believed to be clean.