The renderer should be given an explicitWidth by the time its measure() method 
gets called.  That would be a good time to choose a different size avatar and 
report a different measuredHeight.


On 8/14/10 3:55 PM, "Alexander" <[email protected]> wrote:






Hello,

I have an itemRenderer for a List displaying
avatars for users in chat rooms - up to 3 of them.
It works ok (code below), but since the List
itself is inside of a HDividedBox and its width
can be changed, I would like to detect this
event and let my itemRenderer to display
bigger avatars (increase their scaleX, scaleY).

How do I detect this event and where can
I read-access the parent List width property?

Thank you
Alex

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
width="100%" height="100%" xmlns:my="*"
verticalScrollPolicy="off" horizontalScrollPolicy="off">

<mx:Script>
<![CDATA[

override public function set data(xlist:Object):void {
 var i:int;

super.data = xlist;

for (i = _user.length - 1; i >= 0; i--)
_user[i].visible = false;

if (xlist != null) {
for (i = xlist.user.length() - 1; i >= 0; i--) {
    var xml:XML = xlist.user[i];
    _user[i].userid = x...@id;
    _user[i].avatar = x...@avatar;
    _user[i].nick = x...@name;
    _user[i].visible = true;
}
 }
}

]]>
</mx:Script>

<mx:HBox width="100%" horizontalAlign="center">
<mx:Repeater id="_rpt" dataProvider="{[0, 1, 2]}">

<my:User id="_user" width="160" height="140"
 scaleX="0.8" scaleY="0.8"/>

</mx:Repeater>
</mx:HBox>
</mx:Canvas>






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to