I saw the invalidateDisplayList flag being used in other components, 
but I don't think I can access it (it's mx_internal). I'll try 
overriding the invalidateSize() function and see if that works.

Thanks,
Derek

--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> 
wrote:
>
> One way is to override invalidateSize()  and have them do nothing 
when
> your renderers are at work.
> 
>  
> 
> In updateDisplayList, invalidateDisplayListFlag should still be set 
so
> that calls to invalidateDisplayList() don't do anything.  I think in
> addChild it calls invalidateSize() which restarts the loop.  You can
> always override invalidateDisplayList() as well.
> 
>  
> 
> ________________________________
> 
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of Derek Adams
> Sent: Saturday, April 19, 2008 6:29 PM
> To: [email protected]
> Subject: [flexcomponents] Re: Drawing text on a component without 
adding
> subcomponents
> 
>  
> 
> I have a component that hands off rendering its graphics to a chain 
> of pluggable renderers. The way I have it implemented right now, 
the 
> chain is being executed in the overridden updateDisplayList 
function. 
> The problem that I run into is when a renderer tries to add a child 
> to the parent container, it generates an infinite loop due to 
> addChild forcing an invalidateDisplayList(). Since I don't really 
> need to interact with the text fields, I figured that drawing the 
> bitmaps would be a usable solution. If you know a way to get around 
> the infinite loop problem though, I would rather just be able to 
add 
> components via the renderers. I know you would normally add 
children 
> in the createChildren() function, but the renderers decide what 
gets 
> added and the parent component has no knowledge of their internals.
> 
> Thanks for your help!
> Derek
> 
> --- In [email protected]
> <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui" <aharui@> 
> wrote:
> >
> > Looks right to me. Those are the rules today. Why is having a 
> child
> > TextField so bad? The Bitmaps can be expensive.
> > 
> > 
> > 
> > ________________________________
> > 
> > From: [email protected]
> <mailto:flexcomponents%40yahoogroups.com> 
> > [mailto:[email protected]
> <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of Derek Adams
> > Sent: Saturday, April 19, 2008 10:07 AM
> > To: [email protected]
> <mailto:flexcomponents%40yahoogroups.com> 
> > Subject: [flexcomponents] Drawing text on a component without 
adding
> > subcomponents
> > 
> > 
> > 
> > I have a custom component that needs to be able to paint a label 
on 
> > its graphics context without adding a subcomponent for it. I 
> figured 
> > out a way to do it, but it seems like a hack. Does anybody know a 
> > better way? Here is the code.
> > 
> > // Create an auto-sized text field.
> > var label:IUITextField = new UITextField();
> > label.autoSize = TextFieldAutoSize.LEFT;
> > label.text = "String I want to render";
> > 
> > // Draw the text into a bitmap.
> > var bm:BitmapData = new BitmapData(label.width, label.height);
> > bm.draw(label);
> > 
> > // Draw bitmap on the graphics of the component.
> > comp.graphics.beginBitmapFill(bm, null, false);
> > comp.graphics.drawRect(0, 0, bm.width, bm.height);
> > comp.graphics.endFill();
> > 
> > Any ideas?
> > 
> > Thanks,
> > Derek
> >
>


Reply via email to