[flexcoders] Re: HorizontalList itemRenderer size does not resize on refresh

2009-11-24 Thread mattgarland2000


@Thomas variableRowHeight=true in the mxml.

@Alex I tried remeasuring and resizing but this didn't work right off, so I 
went with Amy's solution.

@Amy--that worked. It's always a pain to strip down to a repeater and work up 
some list functionality but it gives you so much more control, as well as less 
time-consuming mystery. 

Thanks all! Matt Garland.

--- In flexcoders@yahoogroups.com, mattgarland2000 al...@... wrote:

 I am using a horizontallist as an answer bar in an e-learning app. The 
 designer wants the answer boxes to stretch according to content (all should 
 have the same size, and there is a minimum).
 
 This works fine when the dataProvider is set. BUT there is another 
 requirement: after a wrong answer is clicked, there is feedback and the 
 answers are scrambled. 
 
   protected function tryAgain(event:Event):void
   {
   
 answers=CollectionUtils.noRepeatRandomizeXMLList(answers);
   answerListRef.dataProvider=answers;
   } 
 
 After the scrambling, the text values are represented in their new places, 
 and the itemRenderers are resized--but all at the minimum size, so any over 
 the min size need scrollbars. The resize code is called it seems before the 
 data is set. 
 
 I should mention that I have a similar vertical list, with 
 variableRowHeight set to true as well, and there the same code works fine. 
 
 How do I force the HorizontalList to resize the renderers en masse after the 
 new text values are set?




Re: [flexcoders] Re: HorizontalList itemRenderer size does not resize on refresh

2009-11-21 Thread Thomas Silvester
Hi 
show me the code  how your vertical list set to variable height=true , i need 
some thing of this sort to  apply on a popupmenubutton to reduce the height and 
width .please help me out.
thanks,
Tom.


--- On Fri, 11/20/09, mattgarland2000 al...@pet-theory.com wrote:


From: mattgarland2000 al...@pet-theory.com
Subject: [flexcoders] Re: HorizontalList itemRenderer size does not resize on 
refresh
To: flexcoders@yahoogroups.com
Date: Friday, November 20, 2009, 10:45 PM


  





I just noticed that when the largest answer randomly ends up in the first 
position, the result is fine, so it's definitely a matter of getting the 
horizontal list to act as if variableRowHeight is set to true, and not just 
take the measurement of the first renderer and go with that. 

--- In flexcod...@yahoogro ups.com, mattgarland2000 al...@... wrote:

 I am using a horizontallist as an answer bar in an e-learning app. The 
 designer wants the answer boxes to stretch according to content (all should 
 have the same size, and there is a minimum).
 
 This works fine when the dataProvider is set. BUT there is another 
 requirement: after a wrong answer is clicked, there is feedback and the 
 answers are scrambled. 
 
 protected function tryAgain(event: Event):void
 {
 answers=CollectionU tils.noRepeatRan domizeXMLList( answers);
 answerListRef. dataProvider= answers;
 } 
 
 After the scrambling, the text values are represented in their new places, 
 and the itemRenderers are resized--but all at the minimum size, so any over 
 the min size need scrollbars. The resize code is called it seems before the 
 data is set. 
 
 I should mention that I have a similar vertical list, with 
 variableRowHeight set to true as well, and there the same code works fine. 
 
 How do I force the HorizontalList to resize the renderers en masse after the 
 new text values are set?









[flexcoders] Re: HorizontalList itemRenderer size does not resize on refresh

2009-11-21 Thread Amy


--- In flexcoders@yahoogroups.com, mattgarland2000 al...@... wrote:

 
 
 I just noticed that when the largest answer randomly ends up in the first 
 position, the result is fine, so it's definitely a matter of getting the 
 horizontal list to act as if variableRowHeight is set to true, and not just 
 take the measurement of the first renderer and go with that. 

HorizontalList does not have variableRowHeight, and its default behavior _is_ 
to just measure the first item and pretend all the other items are the same 
height.  It sucks, but it seems to me no one is smart enough to calculate the 
optimal best height for the items, taking all possible scenarios into account, 
in a way that won't perform really slowly.

Try using a Repeater instead.

HTH;

Amy



[flexcoders] Re: HorizontalList itemRenderer size does not resize on refresh

2009-11-20 Thread jamesfin



I had a similar predicament recently...

In my renderer code, I setup a listener to respond to external data changes.  
In my case, I just needed to call invalidateDisplayList but you could reset 
your sizes/etc. based upon the new data.


ReportHorizontalList(this.parent.parent).dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE,
 outsideCollectionChanged);

private function outsideCollectionChanged(evt:CollectionEvent):void{
invalidateDisplayList();
}



--- In flexcoders@yahoogroups.com, mattgarland2000 al...@... wrote:

 I am using a horizontallist as an answer bar in an e-learning app. The 
 designer wants the answer boxes to stretch according to content (all should 
 have the same size, and there is a minimum).
 
 This works fine when the dataProvider is set. BUT there is another 
 requirement: after a wrong answer is clicked, there is feedback and the 
 answers are scrambled. 
 
   protected function tryAgain(event:Event):void
   {
   
 answers=CollectionUtils.noRepeatRandomizeXMLList(answers);
   answerListRef.dataProvider=answers;
   } 
 
 After the scrambling, the text values are represented in their new places, 
 and the itemRenderers are resized--but all at the minimum size, so any over 
 the min size need scrollbars. The resize code is called it seems before the 
 data is set. 
 
 I should mention that I have a similar vertical list, with 
 variableRowHeight set to true as well, and there the same code works fine. 
 
 How do I force the HorizontalList to resize the renderers en masse after the 
 new text values are set?





[flexcoders] Re: HorizontalList itemRenderer size does not resize on refresh

2009-11-20 Thread mattgarland2000


I just noticed that when the largest answer randomly ends up in the first 
position, the result is fine, so it's definitely a matter of getting the 
horizontal list to act as if variableRowHeight is set to true, and not just 
take the measurement of the first renderer and go with that. 

--- In flexcoders@yahoogroups.com, mattgarland2000 al...@... wrote:

 I am using a horizontallist as an answer bar in an e-learning app. The 
 designer wants the answer boxes to stretch according to content (all should 
 have the same size, and there is a minimum).
 
 This works fine when the dataProvider is set. BUT there is another 
 requirement: after a wrong answer is clicked, there is feedback and the 
 answers are scrambled. 
 
   protected function tryAgain(event:Event):void
   {
   
 answers=CollectionUtils.noRepeatRandomizeXMLList(answers);
   answerListRef.dataProvider=answers;
   } 
 
 After the scrambling, the text values are represented in their new places, 
 and the itemRenderers are resized--but all at the minimum size, so any over 
 the min size need scrollbars. The resize code is called it seems before the 
 data is set. 
 
 I should mention that I have a similar vertical list, with 
 variableRowHeight set to true as well, and there the same code works fine. 
 
 How do I force the HorizontalList to resize the renderers en masse after the 
 new text values are set?




[flexcoders] Re: HorizontalList itemRenderer size does not resize on refresh

2009-11-20 Thread mattgarland2000
Thx. Gave it a whirl, no dice. 

I need somehow to make the HorizontalList act like it had multiple image sizes, 
and measure them to get the largest rather than going with the first. 

--- In flexcoders@yahoogroups.com, jamesfin james.alan.finni...@... wrote:

 
 
 
 I had a similar predicament recently...
 
 In my renderer code, I setup a listener to respond to external data changes.  
 In my case, I just needed to call invalidateDisplayList but you could reset 
 your sizes/etc. based upon the new data.
 
   
 ReportHorizontalList(this.parent.parent).dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE,
  outsideCollectionChanged);
 
 private function outsideCollectionChanged(evt:CollectionEvent):void{
 invalidateDisplayList();
 }
 
 
 
 --- In flexcoders@yahoogroups.com, mattgarland2000 alias@ wrote:
 
  I am using a horizontallist as an answer bar in an e-learning app. The 
  designer wants the answer boxes to stretch according to content (all should 
  have the same size, and there is a minimum).
  
  This works fine when the dataProvider is set. BUT there is another 
  requirement: after a wrong answer is clicked, there is feedback and the 
  answers are scrambled. 
  
  protected function tryAgain(event:Event):void
  {
  
  answers=CollectionUtils.noRepeatRandomizeXMLList(answers);
  answerListRef.dataProvider=answers;
  } 
  
  After the scrambling, the text values are represented in their new places, 
  and the itemRenderers are resized--but all at the minimum size, so any over 
  the min size need scrollbars. The resize code is called it seems before the 
  data is set. 
  
  I should mention that I have a similar vertical list, with 
  variableRowHeight set to true as well, and there the same code works 
  fine. 
  
  How do I force the HorizontalList to resize the renderers en masse after 
  the new text values are set?
 





RE: [flexcoders] Re: HorizontalList itemRenderer size does not resize on refresh

2009-11-20 Thread Alex Harui
You might have to call measureWidthOfItems/measureHeightOfItems and set 
columnWidth and rowHeight.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.http://www.adobe.com/
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of mattgarland2000
Sent: Friday, November 20, 2009 10:30 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: HorizontalList itemRenderer size does not resize on 
refresh



Thx. Gave it a whirl, no dice.

I need somehow to make the HorizontalList act like it had multiple image sizes, 
and measure them to get the largest rather than going with the first.

--- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
jamesfin james.alan.finni...@... wrote:




 I had a similar predicament recently...

 In my renderer code, I setup a listener to respond to external data changes. 
 In my case, I just needed to call invalidateDisplayList but you could reset 
 your sizes/etc. based upon the new data.

 ReportHorizontalList(this.parent.parent).dataProvider.addEventListener(CollectionEvent.COLLECTION_CHANGE,
  outsideCollectionChanged);

 private function outsideCollectionChanged(evt:CollectionEvent):void{
 invalidateDisplayList();
 }



 --- In flexcoders@yahoogroups.commailto:flexcoders%40yahoogroups.com, 
 mattgarland2000 alias@ wrote:
 
  I am using a horizontallist as an answer bar in an e-learning app. The 
  designer wants the answer boxes to stretch according to content (all should 
  have the same size, and there is a minimum).
 
  This works fine when the dataProvider is set. BUT there is another 
  requirement: after a wrong answer is clicked, there is feedback and the 
  answers are scrambled.
 
  protected function tryAgain(event:Event):void
  {
  answers=CollectionUtils.noRepeatRandomizeXMLList(answers);
  answerListRef.dataProvider=answers;
  }
 
  After the scrambling, the text values are represented in their new places, 
  and the itemRenderers are resized--but all at the minimum size, so any over 
  the min size need scrollbars. The resize code is called it seems before the 
  data is set.
 
  I should mention that I have a similar vertical list, with 
  variableRowHeight set to true as well, and there the same code works fine.
 
  How do I force the HorizontalList to resize the renderers en masse after 
  the new text values are set?