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 [email protected], "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
.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
lt.aspx>  & subscribe 
<blocked::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
osts/Archive.aspx> .
>


Reply via email to