Ok 2 things, better to change the image in the set data method and then
invalidateDisplayList(); because updateDisplayList gets called a lot more
frequently than than the data changes. And for the image, add an Image control
to the UIComponent itemRenderer in createChildren. (remember to setActualSize
and position in updateDisplayList). Then when the data changes, inspect it and
change the source of the image to one of several embedded image classes in the
itemRenderer. Something like:
[Embed(source="../assets/butterfly.gif")]
public var myButterfly:Class;
[Embed(source="../assets/grassHopper.gif")]
public var myGrassHopper:Class;
public function set data(value:Object):void
{
// perform conditional logic here
// don't know your code, so psuedo
if ( butterfly )
{
myImage.source = myButterfly;
}
if ( grasshopper )
{
myImage.source = myGrasshopper;
}
super.invalidateDisplayList();
}
-TH
--- In [email protected], Vivian Richard <kanps...@...> wrote:
>
> Thanks for the reply. I got the logic part. In updateDisplayList I get
> the
> data like data.item.type = spider or bee or butterfly .....
>
> so depending on the type I want to show the image of the insects. But
> the problem is since this itemrenderer inherits UIComponent, I cannot
> or do not know how to add an image on it.
>
>
>
>
> On Tue, Nov 17, 2009 at 9:28 AM, turbo_vb <timh...@...> wrote:
>
> >
> >
> > Thanks Vivian,
> >
> > For the plot chart, you can do the same type of thing, except with more
> > images, with an itemRenderer. Just like the way you can change icons, or
> > images, in a List itemRenderer, the same can be done with a chart. In the
> > last sample, you can see how to inspect the data; to determine which image
> > class to display. This next
> > <http://www.timothyhoff.com/projects/ChartLabeledRendererSample/srcview/index.html>
> > Sample<http://www.timothyhoff.com/projects/ChartLabeledRendererSample/ChartLabeledRendererSample.html>
> > shows how you can use an itemRenderer that extends UIComponent. This is
> > a little different than creating an itemRenderer that extends
> > ProgrammaticSkin, as it gives you a lot more flexibility. Between the two
> > samples, you might be able to come up with a solution. If you get stuck,
> > please feel free to reach out.
> >
> > -TH
> >
> > --- In [email protected], Vivian Richard <kanpsack@> wrote:
> > >
> > > Liked your example. Sleek!!! By the way I am trying to write an
> > > itemrenderer
> > > for plot chart. Depending on the value of the plot item I want to show
> > > different
> > > icons in the plotted spot. These is an example of plot chart where you
> > > can
> > > embed an image but in that way you can only put same image in one series.
> > > Here is the link:
> > >
> > >
> > >
> > http://livedocs.adobe.com/flex/3/html/help.html?content=charts_formatting_12.html
> > >
> > > The butterfly example - I am talking about.
> > >
> > >
> > >
> > > On Mon, Nov 16, 2009 at 3:02 PM, turbo_vb TimHoff@ wrote:
> > >
> > > >
> > > >
> > > > Cool, yeah I should have said custom lineSegmentRenderer.
> > > >
> > > >
> > > > -TH
> > > >
> > > > --- In [email protected] <flexcoders%40yahoogroups.com>, Jake
> >
> > > > Churchill reynacho@ wrote:
> > > > >
> > > > > THANK YOU. I have seen this before and I've been looking for it
> > forever.
> > > > > The stinking chart components are all in the dataviz SWC and I
> > couldn't
> > > > get
> > > > > past a null error I was getting.
> > > > >
> > > > > On Mon, Nov 16, 2009 at 4:43 PM, turbo_vb TimHoff@ wrote:
> > > > >
> > > > > >
> > > > > >
> > > > > > Sorry bout that, let's try it again: Sample<
> > > >
> > http://www.timothyhoff.com/projects/LineRendererSample/LineRendererSample.html
> > > > >
> > > >
> > > > > >
> > > > > >
> > > > > > -TH
> > > > > >
> > > > > > --- In [email protected] <flexcoders%40yahoogroups.com>,
> > Jake
> >
> > > > Churchill <reynacho@> wrote:
> > > > > > >
> > > > > > > I've been trying something like this but item renders and actual
> > > > segments
> > > > > > of
> > > > > > > the line seem to be drawn separately. By the way, your link
> > doesn't
> > > > work.
> > > > > > >
> > > > > > > On Mon, Nov 16, 2009 at 3:35 PM, turbo_vb TimHoff@ wrote:
> > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Hi Jake,
> > > > > > > >
> > > > > > > > You could do it with a custom itemRenderer and control the
> > alpha or
> > > > > > actual
> > > > > > > > drawing; based on a data property. Here's a custom renderer
> > sample
> > > > to
> > > > > > get
> > > > > > > > you started:
> > > > > > > >
> > > > > > > > Colored Line Chart Sample<
> > > > > > http://www.flashcomguru.com/index.cfm/2009/11/11/pdf-for-flex-devs
> > >
> > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > -TH
> > > > > > > >
> > > > > > > > --- In [email protected] <flexcoders%
> > 40yahoogroups.com>,
> >
> > > > Jake Churchill reynacho@ wrote:
> > > > > > > > >
> > > > > > > > > I'm struggling with how to hide a section of a LineSeries.
> > Does
> > > > > > anyone
> > > > > > > > have
> > > > > > > > > any pointers or links to point me in the right direction?
> > > > > > > > >
> > > > > > > > > Thanks!
> > > > > > > > >
> > > > > > > > > -Jake
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > >
> >
> >
>