Remember that what is inside an mx:Component tag is a template for a renderer 
that is often instantiated many times and recycled for use with different data 
objects.  Therefore, there is no one reference to it.

There are APIs like indexToItemRenderer and references to an itemRenderer in 
various events like ITEM_ROLL_OVER, but it is considered "bad practice".  The 
renderer should be deriving everything by pulling from its data field and the 
outerDocument

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of dnk
Sent: Thursday, January 22, 2009 9:02 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Re: opposite of outterDocument?


Well I tried refernecing it that way, but no go.

The other thing is that you are not allowed to put an id on the root
tag of a component. Ends up with this error:

id attribute is not allowed on the root tag of a component.

So I am not sure how you would be able to reference the child of the
<mx:component> tag.

You can set an id on the <mx:component> tag itself.. .and i was hoping
to reference it that way, but that gives me a :

: Call to a possibly undefined method goToDownload through a reference
with static type mx.core:ClassFactory

I had mentioned that in one of my other responses.

d

On 22-Jan-09, at 8:26 AM, oneworld95 wrote:

> The way I did this (and it's probably not the most efficient) was
> this:
> - User clicked a button inside the mx:component tag.
> - The click call passed a reference to the VBox container to the
> outer document function.
> - In the outer document function, I'd use the reference like this:
>
> var vb:VBox = vbox; // vbox is the reference to object in component
> var text:TextInput = vb.getChildAt(2) as TextInput;
>
> I wish there was a cleaner way, like setting an ID on the mx:component
> tag and then referencing its children. But I think the component is
> treated as a different class altogether.
>
> - Alex
>
> --- In flexcoders@yahoogroups.com<mailto:flexcoders%40yahoogroups.com>, dnk 
> <d.k.emailli...@...> wrote:
> >
> > Is there something the opposite of outterDocument to access vars and
> > methods inside of a mx:component tag?
> >
> > or is it as simple as (no where near my flex machine):
> >
> > <mx:Component id="something">
> >
> > <custom:mycomp />
> >
> > </mx:Component>
> >
> >
> > <script>
> >
> > something.mymethod;
> >
> >
> >
> >
> > Thanks!
> >
> > d

Reply via email to