Just be aware that anything marked mx_internal is subject to change
without notice.

 

Gordon Smith

Adobe Flex SDK Team

 

________________________________

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Derek Adams
Sent: Wednesday, April 23, 2008 3:17 PM
To: [email protected]
Subject: [flexcomponents] Re: Drawing text on a component without adding
subcomponents

 

I had no idea you could access variables in the mx_internal namespace.
Very cool!  It didn't work at first because I didn't know you had to
import mx_internal (good blog coverage here
<http://raghuonflex.wordpress.com/2007/09/03/mx_internal-a-life->  ).
Anyway, it works like a charm and doesn't seem like a hack. Thanks for
your help!

Derek


--- In [email protected], "Eric Cancil" <[EMAIL PROTECTED]>
wrote:
>
> You can access mx_interval variables you have touse namespace
mx_internal
> then you can say mx_internal::invalidateDisplayList = true;
> 
> On Sun, Apr 20, 2008 at 1:41 PM, Derek Adams [EMAIL PROTECTED]
> wrote:
> 
> > 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]
<flexcomponents%40yahoogroups.com>,
> > "Alex Harui" aharui@
> > 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]
<flexcomponents%40yahoogroups.com>
> > >
[mailto:[email protected]<flexcomponents%40yahoogroups.com>
]
> > On Behalf Of Derek Adams
> > > Sent: Saturday, April 19, 2008 6:29 PM
> > > To: [email protected]
<flexcomponents%40yahoogroups.com>
! > > ; > 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
> > ad! d
> > > 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]
<flexcomponents%40yahoogroups.com>
> > >
<mailto:flexcomponents%40yahoogroups.com<flexcomponents%2540yahoogroups.
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.
> > > >
> > > >
> > > >
> &! gt; > > ________________________________> > > >
> > > > From:
[email protected]<flexcomponents%40yahoogroups.com>
> > >
<mailto:flexcomponents%40yahoogroups.com<flexcomponents%2540yahoogroups.
com>>
> >
> > > >
[mailto:[email protected]<flexcomponents%40yahoogroups.com>
> > >
<mailto:flexcomponents%40yahoogroups.com<flexcomponents%2540yahoogroups.
com>>
> > ] On Behalf Of Derek Adams
> > > > Sent: Saturday, April 19, 2008 10:07 AM
> > > > To: [email protected]
<flexcomponents%40yahoogroups.com>
> > >
<mailto:flexcomponents%40yahoogroups.com<flexcomponents%2540yahoogroups.
com>>
> >
> > > > Subject: [flexcomponents] Drawing text on a component without
> > ad! ding
> > > > 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 com ponent.
> > > > 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