My vote would be for changes in A to affect a central model. B would watch the model change and reflect those changes. Everything B needs from A would be reflected in the model. That's pretty much what Mike said, except I'm not a fan of "throwing events up" if that means "bubbling". A should dispatch events that the app listens to in order to change the central model.
However, I would think that there is some syntax that should have got this past the compiler. If you use the MXMLC -keep option you can see what it generated and maybe figure out why it didn't work. ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Labriola Sent: Friday, June 27, 2008 8:20 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: One custom component referring to another Jason, In an ideal world, component A would throw events up. Those events would be caught in the application (in this case) and call corresponding methods in component B. You really, really don't want to start coupling these components together by calling the internals of one from the other in this way. Especially when they really are peers in your application. Just my 2 cents, Mike --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Merrill, Jason" <[EMAIL PROTECTED]> wrote: > > I thought this would be simple - having one custom display object modify another through a reference: > > <mx:Application > > <c:MyComponentA /> > <c:MyComponentB /> > </mx:Application> > > I want to have MyComponentA refer to objects/methods inside of MyComponentB. I tried passing a reference in: > > <mx:Application > > <c:MyComponentA id="myComponentA" /> > <c:MyComponentB componentToModify="{myComponentA}"/> > </mx:Application> > > But I get an error saying, "Access of possibly undefined property myComponentA through a reference with static type flash.display:DisplayObject." > > I tried calling "parent.myComponentA" from actionscript inside of MyComponentB.MXML, but it couldn't find the instance of "myComponentA". > > How do you handle this? I know this probably isn't ideal architecture, but would there have to be scripts that listen for events in one component in the main app and then modify the other component? I guess I could do that if it is best practice. I need the two components to be separated because they are two different parts of the UI, but need to interact. One has controls that change the view and data in the other. Does it have to modify the other component from actionscript on the main app or can I just pass a reference into one component like I have tried? > > Thanks. > > > Jason Merrill > Bank of America > Global Technology & Operations & Global Risk L&LD > eTools & Multimedia > > Join the Bank of America Flash Platform Developer Community <blocked::http://sharepoint.bankofamerica.com/sites/tlc/flash/default <http://sharepoint.bankofamerica.com/sites/tlc/flash/default> .aspx> > > Are you a Bank of America associate interested in innovative learning ideas and technologies? > Check out our internal GT&O Innovative Learning Blog <blocked::http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/defau <http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/defau> lt.aspx> & subscribe <blocked::http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/_layo <http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/_layo> uts/SubNew.aspx?List=\{41BD3FC9-BB07-4763-B3AB-A6C7C99C5B8D\} &Source=http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/Lists/P <http://sharepoint.bankofamerica.com/sites/ddc/rd/blog/Lists/P> osts/Archive.aspx> . >