I know this is basic stuff for most of you, but I thought I would add it for
anybody who may have a similar problem. I got the item renderer to work by
adding the following code:

override public function set data(value:Object):void{
    super.data = value;

    width = AppVars.appWidth * .4;
    multiline = false;
    lineBreak = LineBreak.EXPLICIT;
    truncateToFit("...");
}

Apparently, it is important to wait until the "data" has changed before you
take the actions to truncate the text, but you also have to set a width for
the StyleableTextField that is the basis of the itemrenderer for the
truncateToFit method to work properly. The thing that I cannot figure out is
why I have to calculate a width the way that I have done above instead of
getting it from the MobileGrid that the itemrenderer works on. I would think
width=this.width, or width = parent.width, or width = owner.width or
something along these lines would work, but I was sadly disappointed. In
other words, I have to write a different itemrenderer for every column that
I want to truncate because I cannot get the width of the column from within
the itemrenderer.

Any thoughts on how I might effectively get the width of the column from
within the itemrenderer so that I can apply it to the width of the
StyleableTextField so that it will truncate at the appropriate place in the
string???



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Reply via email to