[flexcoders] Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread wubac1
I'm attempting to create a very simple item renderer for mx:List. I've found
that when the dataProvider is static, there are no problems with the custom item
renderer. However, when the dataProvider is dynamic, the height of the item
renderer is not correct (and scroll bars appear for each renderer with any 
meaningful # of rows). I've set variableRowHeight=true for the List. I've
also tried overriding the measure function and invaliding the size when a
dataChange event is dispatched (based on information provided on FlexCoders in 
previous discussions along these lines).

CommentRenderer.mxml:

?xml version=1.0 encoding=utf-8?
mx:VBox xmlns:mx=http://www.adobe.com/2006/mxml; width=100%
mx:Script
![CDATA[
override protected function measure():void
{
super.measure();
measuredHeight = comment.textHeight;
}
]]
/mx:Script
mx:LinkButton label={data.commenter.name}/
mx:Text id=comment width=100% text={data.comment}
dataChange=invalidateSize()/
/mx:VBox


The mx:List definition:

mx:List id=comments itemRenderer=com.test.CommentRenderer width=100%
height=100%/


I've looked over the ListItemRenderer, but have so far been unable to glean the
magic sauce that makes the item renderer function correctly when the control
recycles. Can someone explain / provide a functional example(s) with mx:Text 
(ActionScript and MXML examples preferred, for completeness)?




RE: [flexcoders] Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread Tracy Spratt
Sorry, no magic sauce here.  I had some pixie dust somewhere, but. Was it
Asimov or Clark that said, Any sufficiently advanced technology is
indistinguishable from magic?

 

When I needed a variable height renderer, I copied ListItemRenderer and
modified to my needs.  That was the only way I could get it to work. It is
also *much* more performant than a container based renderer.  The magic is
indeed in the measure() function.  

 

If you do not have a lot of items to renderer, Repeater works well with
variable heights.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of wubac1
Sent: Saturday, April 18, 2009 2:02 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Custom List ItemRenderer / Recycling troubles (height
incorrect)

 






I'm attempting to create a very simple item renderer for mx:List. I've found
that when the dataProvider is static, there are no problems with the custom
item
renderer. However, when the dataProvider is dynamic, the height of the item
renderer is not correct (and scroll bars appear for each renderer with any
meaningful # of rows). I've set variableRowHeight=true for the List. I've
also tried overriding the measure function and invaliding the size when a
dataChange event is dispatched (based on information provided on FlexCoders
in previous discussions along these lines).

CommentRenderer.mxml:

?xml version=1.0 encoding=utf-8?
mx:VBox xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml
com/2006/mxml width=100%
mx:Script
![CDATA[
override protected function measure():void
{
super.measure();
measuredHeight = comment.textHeight;
}
]]
/mx:Script
mx:LinkButton label={data.commenter.name}/
mx:Text id=comment width=100% text={data.comment}
dataChange=invalidateSize()/
/mx:VBox

The mx:List definition:

mx:List id=comments itemRenderer=com.test.CommentRenderer width=100%
height=100%/

I've looked over the ListItemRenderer, but have so far been unable to glean
the
magic sauce that makes the item renderer function correctly when the control
recycles. Can someone explain / provide a functional example(s) with mx:Text
(ActionScript and MXML examples preferred, for completeness)?





[flexcoders] Re: Need Suggestions for Reporting In Flex Applications.

2009-04-18 Thread raja_s_patil
Thanks Dean,

 I have no idea about the dot matrix printers. But generally I do
 all my reporting using PHP. At the end of the day flex is in a
 browser and you are going to be limited by that. I'm sure PHP 
 can produce a format that would work well for a dot matrix printer.
 If not, you could always have a TCP server written in any language
 to allow Flex to send data to it for reporting. This would be done
 using socket code in Flex. This also requires the server to accept
 a request for a security policy on a specific port. I will look 
 for details on that.

Well, I was bit worried about Flex's capacity to produce reports
I dont mind about PHP producing reports in text format if it can
write text file on server which can be fetched to client via FTP
or if PHP can produce PDFs that can serve purpose of Windows graphis
mode printing. The data exports to xls, dbf, ods etc. etc. still 
remain. I dont know what to do about.

For sec of discussion how about using Birt on server to produce
reports? have u given any thought to this ? But again we have to 
have Java at server. Can PHP send data to any program on server 
to produce reports then we can use delphi exe to run in wine 
and listen to TCP port on Linux Server and if its windows server 
then it can run natively. I dont know what reporting strategies 
are followed by ppl developing web applications. I dont have 
any experience in web development but there must be some way 
to produce reports, Since all over the world big web database
applications are already running.

BTW how u are doing reports I will follow your suit till we 
find some generous way for elegant reporting in flex.

Thanks once again and best regards

Raja




[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread Tim Hoff

Hi,

Set the List's variableRowHeight=true and use something like this in
the itemRenderer:

override protected function measure():void
{
  var textLineMetrics:TextLineMetrics = comment.measureText(
comment.text );

  // should add paddingTop, paddingBottom and verticalGap to this too
  measuredHeight = textLineMetrics.height + myLinkButton.height;
}

-TH

--- In flexcoders@yahoogroups.com, Tracy Spratt tr...@... wrote:

 Sorry, no magic sauce here. I had some pixie dust somewhere, but. Was
it
 Asimov or Clark that said, Any sufficiently advanced technology is
 indistinguishable from magic?



 When I needed a variable height renderer, I copied ListItemRenderer
and
 modified to my needs. That was the only way I could get it to work. It
is
 also *much* more performant than a container based renderer. The magic
is
 indeed in the measure() function.



 If you do not have a lot of items to renderer, Repeater works well
with
 variable heights.



 Tracy Spratt,

 Lariat Services, development services available

 _

 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
On
 Behalf Of wubac1
 Sent: Saturday, April 18, 2009 2:02 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Custom List ItemRenderer / Recycling troubles
(height
 incorrect)








 I'm attempting to create a very simple item renderer for mx:List. I've
found
 that when the dataProvider is static, there are no problems with the
custom
 item
 renderer. However, when the dataProvider is dynamic, the height of the
item
 renderer is not correct (and scroll bars appear for each renderer with
any
 meaningful # of rows). I've set variableRowHeight=true for the List.
I've
 also tried overriding the measure function and invaliding the size
when a
 dataChange event is dispatched (based on information provided on
FlexCoders
 in previous discussions along these lines).

 CommentRenderer.mxml:

 ?xml version=1.0 encoding=utf-8?
 mx:VBox xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml
 com/2006/mxml width=100%
 mx:Script
 ![CDATA[
 override protected function measure():void
 {
 super.measure();
 measuredHeight = comment.textHeight;
 }
 ]]
 /mx:Script
 mx:LinkButton label={data.commenter.name}/
 mx:Text id=comment width=100% text={data.comment}
 dataChange=invalidateSize()/
 /mx:VBox

 The mx:List definition:

 mx:List id=comments itemRenderer=com.test.CommentRenderer
width=100%
 height=100%/

 I've looked over the ListItemRenderer, but have so far been unable to
glean
 the
 magic sauce that makes the item renderer function correctly when the
control
 recycles. Can someone explain / provide a functional example(s) with
mx:Text
 (ActionScript and MXML examples preferred, for completeness)?





[flexcoders] Date data type in DataGrid

2009-04-18 Thread srinuguda
Dear Friends,

In a data grid, how to identify that a field is of type DATE?.

I am assigning datagrid.COLUMNS to combo box data providers (for search). For 
date field I have a separate search method. To call this I need to identify the 
DATA TYPE of column.

Thanks in Advance.

Regards,
Srini.



[flexcoders] how to convert Html pages or text(html text) into a pdf document.

2009-04-18 Thread Hasain Sab
Hi Friends,

can anybody suggest me how to convert Html pages or text(html text) into a 
pdf document on the fly .

I have already used AlivePdf but did not got the desired results.
please reply soon if any ideas.

Thanks in Advance.
Hasain



[flexcoders] Alternatives to ILOG Elixir (Diary and Resource Planner) components

2009-04-18 Thread randc5849
Hi there - does anyone know of any good alternatives to two of the ILOG Elixir 
components, specifically the Calendar component and the resource chart (URLs 
below).  My company only needs these two pieces of functionality for the 
application but the cost I've been quoted for ILOG is over £10k.

http://visudemos.ilog.com/webdemos/humanresources/humanresources.html
http://visudemos.ilog.com/webdemos/calendar/calendar.html

thanks in advance for any advice.

Richard.



Re: [flexcoders] Need Suggestions for database application.

2009-04-18 Thread riacoding

Hi Raja,

I have been searching around for a while on different setups for flex and
have recently been using the following: A Flex UI with symfony framework on
php5.2.8 on MySQL database. Although I have only been trying out the symfony
framework for a while it appears very powerful and would meet your criteria
of using multiple database vendors. There are also some great tutorials on
their site www.symfony-project.org

Regards,
Lee
riaCoding


Raja S Patil wrote:
 
 
 
 1 The application should be independent of Backend database.
i.e. it should be able to use any of Oracle, MS-SQL, MySQL,
PostgreSQL, Firebird as backend.
 2 The business logic should move from Stored procedures to some
middle layer i.e. to Application server.
 3 It should be possible to separate application server and database
server i.e. application server and Database servers can be at
different physical locations or they can reside on same server.
 4 the communication between database server-application server and
application Server-Client should be secured one or may be
encrypted so that man in middle is not able to modify the data
 
 .
 
 Thanks for reading this long post and best regards
 
 raja
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Need-Suggestions-for-database-application.-tp23071392p23100077.html
Sent from the FlexCoders mailing list archive at Nabble.com.



Re: [flexcoders] Need Help

2009-04-18 Thread riacoding

Hi Heman

I not sure if you are already generating the CSV file from the datagrid? if
not this should help
http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/datagriddataexporter.php

regards
Lee
riaCoding


heman babu wrote:
 
 
  i need the excel file generated from the datagrid to be attached as an
 attachment in the email?.Please suggest me some good ideas and examples.
 RegardsHeman
 
 
 
   
 

-- 
View this message in context: 
http://www.nabble.com/Need-Help-tp23097399p23100598.html
Sent from the FlexCoders mailing list archive at Nabble.com.



[flexcoders] Re: create a thumbnail dynamically from large image using flex

2009-04-18 Thread aphexyuri
I knew I had a class I wrote to do this...
If you have the large image, get its bitmapData, feed it to this function with 
target's dimensions, and boom...you'll get the resized 'thumbnail' as Bitmap. 
You can also change the return type and return the bitmapData newBmd (sorry 
about the formatting)

public function scaleBitmapData(_bmd:BitmapData, targetContainerWidth:Number, 
targetContainerHeight:Number):Bitmap {
//set matrix sx  sy 
var sx:Number = targetContainerWidth / _bmd.width;
var sy:Number = targetContainerHeight / _bmd.height;

//instantiate new matrix, and set scaling
var m:Matrix = new Matrix();
m.scale(sx, sy);

//create new bitmapdata 
var newBmd:BitmapData = new BitmapData(targetContainerWidth, 
targetContainerHeight);

//draw new bitmapdata with matrix   
newBmd.draw(_bmd, m);

//create final bitmap with new bitmapdata
var newBmp:Bitmap = new Bitmap(newBmd);

//set smooting to true
newBmp.smoothing = true;

//boom!
return newBmp;
}

--- In flexcoders@yahoogroups.com, stinasius stinas...@... wrote:

 i just need a way to create a thumbnail from a larger image dynamically in 
 flex so that i dont have to store both a thumb and large image of the same 
 image. trying to save on storage and load time of application. can some one 
 please help out. thanks





[flexcoders] Re: create a thumbnail dynamically from large image using flex

2009-04-18 Thread stinasius
hi, please share the whole class please.



[flexcoders] Reoading a view from a viewstack

2009-04-18 Thread Wally Kolcz
My application uses a ToggleButtonBar with a viewstack as it's dataprovider. 
When the app is first loaded and each component is called in the stack, it 
loads the component and runs it's initApp() on the creationComplete. However 
when you go back it's already loaded and doesn't run the initApp() and pull new 
external data. 

Is there a way to automatically reload the component each time a generated 
button is pushed in the ToggleButtonBar? 




[flexcoders] Re: create a thumbnail dynamically from large image using flex

2009-04-18 Thread reygeek
He shared all you need.  Just pass in bitmap data of your image which I believe 
is the source attribute.

var newImg:Image = new Image();
newImg.source = scaleBitmapData(originalImage.source,width,height);

--- In flexcoders@yahoogroups.com, stinasius stinas...@... wrote:

 hi, please share the whole class please.





[flexcoders] Re: create a thumbnail dynamically from large image using flex

2009-04-18 Thread reygeek
Here's another method that would allow you to pass in the whole UIComponent.  
Below is an example usage:

public function getUIComponentBitmapData( target:UIComponent, w:Number, 
h:Number ) : BitmapData
{ 
// scale down (or up)
var scaleX:Number = w / target.width;
var scaleY:Number = h / target.height;
var m:Matrix = new Matrix();
m.scale(scaleX, scaleY);

// get new bitmap data
var bd:BitmapData = new BitmapData( w, h );
bd.draw( target, m );
bd.smoothing = true;

// return the new bitmap data
return bd;  
}



Assume you have var originalImage:Image already set and you want to scale it 
down to 50x30:

var newImage:Image = new Image();
newImage.source = getUIComponentBitmapData( originalImage, 50, 30 );



--- In flexcoders@yahoogroups.com, stinasius stinas...@... wrote:

 hi, please share the whole class please.





[flexcoders] Tradeoffs

2009-04-18 Thread Mike Oliver

What are the tradeoffs between creating a flex project with the J2EE type vs
None type?

The J2EE type is about 10% larger from what I can tell, but the None type
seems to work just fine in the browser.

If we start with None type, and then add ActionScript calls to the Remote
interface it seems to work just fine, but I wonder about performance.
-- 
View this message in context: 
http://www.nabble.com/Tradeoffs-tp23114437p23114437.html
Sent from the FlexCoders mailing list archive at Nabble.com.



[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread wubac1
Tracy, I have to agree.  I was able to get a fully functional item renderer 
based on ListItemRenderer.  However, in theory, one should be able to do it in 
MXML.  With that in mind, I replaced the UITextField with mx:Text.  It's 
probably not surprising to many that the renderer does not behave as expected 
anymore.  The height issue appears to be tied to the component in some fashion. 
 I'd file a defect but I haven't seen much ROI in such reports.

--- In flexcoders@yahoogroups.com, Tracy Spratt tr...@... wrote:

 Sorry, no magic sauce here.  I had some pixie dust somewhere, but. Was it
 Asimov or Clark that said, Any sufficiently advanced technology is
 indistinguishable from magic?
 
  
 
 When I needed a variable height renderer, I copied ListItemRenderer and
 modified to my needs.  That was the only way I could get it to work. It is
 also *much* more performant than a container based renderer.  The magic is
 indeed in the measure() function.  
 
  
 
 If you do not have a lot of items to renderer, Repeater works well with
 variable heights.
 
  
 
 Tracy Spratt,
 
 Lariat Services, development services available
 
   _  
 
 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
 Behalf Of wubac1
 Sent: Saturday, April 18, 2009 2:02 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Custom List ItemRenderer / Recycling troubles (height
 incorrect)
 
  
 
 
 
 
 
 
 I'm attempting to create a very simple item renderer for mx:List. I've found
 that when the dataProvider is static, there are no problems with the custom
 item
 renderer. However, when the dataProvider is dynamic, the height of the item
 renderer is not correct (and scroll bars appear for each renderer with any
 meaningful # of rows). I've set variableRowHeight=true for the List. I've
 also tried overriding the measure function and invaliding the size when a
 dataChange event is dispatched (based on information provided on FlexCoders
 in previous discussions along these lines).
 
 CommentRenderer.mxml:
 
 ?xml version=1.0 encoding=utf-8?
 mx:VBox xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml
 com/2006/mxml width=100%
 mx:Script
 ![CDATA[
 override protected function measure():void
 {
 super.measure();
 measuredHeight = comment.textHeight;
 }
 ]]
 /mx:Script
 mx:LinkButton label={data.commenter.name}/
 mx:Text id=comment width=100% text={data.comment}
 dataChange=invalidateSize()/
 /mx:VBox
 
 The mx:List definition:
 
 mx:List id=comments itemRenderer=com.test.CommentRenderer width=100%
 height=100%/
 
 I've looked over the ListItemRenderer, but have so far been unable to glean
 the
 magic sauce that makes the item renderer function correctly when the control
 recycles. Can someone explain / provide a functional example(s) with mx:Text
 (ActionScript and MXML examples preferred, for completeness)?





[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread wubac1
Tim, I have been using the variableRowHeight (see my original example).  Also, 
one should not need to replicate the measure of mx:Text.  Your example 
disregards internal padding elements of the Text component.  I did try 
setActualSize combined with getExplicitOrMeasuredHeight, but that only works in 
ActionScript.  I encourage you to try and create a functional example.  I'm 
fairly confident at this point that you will not get one working in MXML with 
mx:Text (multi-line).

I was able to get a fully functional item renderer based on ListItemRenderer, 
which uses UITextField. However, in theory, one should be able to do it in 
MXML. With that in mind, I replaced the UITextField of my ActionScript-based 
renderer with mx:Text. It's probably not surprising to many that the renderer 
no longer behaves as expected. The height issue appears to be tied to the 
component in some fashion (mx:Text in this case).  I'd file a defect but I 
haven't seen much ROI in such reports.

--- In flexcoders@yahoogroups.com, Tim Hoff timh...@... wrote:

 
 Hi,
 
 Set the List's variableRowHeight=true and use something like this in
 the itemRenderer:
 
 override protected function measure():void
 {
   var textLineMetrics:TextLineMetrics = comment.measureText(
 comment.text );
 
   // should add paddingTop, paddingBottom and verticalGap to this too
   measuredHeight = textLineMetrics.height + myLinkButton.height;
 }
 
 -TH
 
 --- In flexcoders@yahoogroups.com, Tracy Spratt tracy@ wrote:
 
  Sorry, no magic sauce here. I had some pixie dust somewhere, but. Was
 it
  Asimov or Clark that said, Any sufficiently advanced technology is
  indistinguishable from magic?
 
 
 
  When I needed a variable height renderer, I copied ListItemRenderer
 and
  modified to my needs. That was the only way I could get it to work. It
 is
  also *much* more performant than a container based renderer. The magic
 is
  indeed in the measure() function.
 
 
 
  If you do not have a lot of items to renderer, Repeater works well
 with
  variable heights.
 
 
 
  Tracy Spratt,
 
  Lariat Services, development services available
 
  _
 
  From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
 On
  Behalf Of wubac1
  Sent: Saturday, April 18, 2009 2:02 AM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Custom List ItemRenderer / Recycling troubles
 (height
  incorrect)
 
 
 
 
 
 
 
 
  I'm attempting to create a very simple item renderer for mx:List. I've
 found
  that when the dataProvider is static, there are no problems with the
 custom
  item
  renderer. However, when the dataProvider is dynamic, the height of the
 item
  renderer is not correct (and scroll bars appear for each renderer with
 any
  meaningful # of rows). I've set variableRowHeight=true for the List.
 I've
  also tried overriding the measure function and invaliding the size
 when a
  dataChange event is dispatched (based on information provided on
 FlexCoders
  in previous discussions along these lines).
 
  CommentRenderer.mxml:
 
  ?xml version=1.0 encoding=utf-8?
  mx:VBox xmlns:mx=http://www.adobe. http://www.adobe.com/2006/mxml
  com/2006/mxml width=100%
  mx:Script
  ![CDATA[
  override protected function measure():void
  {
  super.measure();
  measuredHeight = comment.textHeight;
  }
  ]]
  /mx:Script
  mx:LinkButton label={data.commenter.name}/
  mx:Text id=comment width=100% text={data.comment}
  dataChange=invalidateSize()/
  /mx:VBox
 
  The mx:List definition:
 
  mx:List id=comments itemRenderer=com.test.CommentRenderer
 width=100%
  height=100%/
 
  I've looked over the ListItemRenderer, but have so far been unable to
 glean
  the
  magic sauce that makes the item renderer function correctly when the
 control
  recycles. Can someone explain / provide a functional example(s) with
 mx:Text
  (ActionScript and MXML examples preferred, for completeness)?
 





[flexcoders] Re: Need Suggestions for database application.

2009-04-18 Thread raja_s_patil
Thanks Lee,

 
 I have been searching around for a while on different setups for flex and
 have recently been using the following: A Flex UI with symfony framework on
 php5.2.8 on MySQL database. Although I have only been trying out the symfony
 framework for a while it appears very powerful and would meet your criteria
 of using multiple database vendors. There are also some great tutorials on
 their site www.symfony-project.org

Well one more avenue, I will consider this too.
Just for sec of information can u just briefly mention
how u are using it wrt Flex application and how database
abstraction is achieved in Symphony ?

To best of my knowledge only persistence is to be handled by
PHP server and in a very fast browse of website i could not
locate any information about handling persistence. I feel that
Flex application will need data to/fro from server either in XML
format or in form of data objects rest of the things will be 
taken care by Serverside framework. Off course performance also
a factor to be considered.  

Have u tested it on multiple dbms ?

Thanks Once again and best regards. 

Raja



[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread Tim Hoff

Hi,

Yes, after playing with it a little, you're correct; my suggestion only
works in AS.  Sorry, I always extend UIComponent for itemRenderers that
need to have a variableRowHeight.

BTW, in the future, please sign your posts; so that we can put a name to
your warm and positive comments.

-TH

--- In flexcoders@yahoogroups.com, wubac1 wub...@... wrote:

 Tim, I have been using the variableRowHeight (see my original
example). Also, one should not need to replicate the measure of mx:Text.
Your example disregards internal padding elements of the Text component.
I did try setActualSize combined with getExplicitOrMeasuredHeight, but
that only works in ActionScript. I encourage you to try and create a
functional example. I'm fairly confident at this point that you will not
get one working in MXML with mx:Text (multi-line).

 I was able to get a fully functional item renderer based on
ListItemRenderer, which uses UITextField. However, in theory, one should
be able to do it in MXML. With that in mind, I replaced the UITextField
of my ActionScript-based renderer with mx:Text. It's probably not
surprising to many that the renderer no longer behaves as expected. The
height issue appears to be tied to the component in some fashion
(mx:Text in this case). I'd file a defect but I haven't seen much ROI in
such reports.

 --- In flexcoders@yahoogroups.com, Tim Hoff TimHoff@ wrote:
 
 
  Hi,
 
  Set the List's variableRowHeight=true and use something like this
in
  the itemRenderer:
 
  override protected function measure():void
  {
  var textLineMetrics:TextLineMetrics = comment.measureText(
  comment.text );
 
  // should add paddingTop, paddingBottom and verticalGap to this too
  measuredHeight = textLineMetrics.height + myLinkButton.height;
  }
 
  -TH
 
  --- In flexcoders@yahoogroups.com, Tracy Spratt tracy@ wrote:
  
   Sorry, no magic sauce here. I had some pixie dust somewhere, but.
Was
  it
   Asimov or Clark that said, Any sufficiently advanced technology
is
   indistinguishable from magic?
  
  
  
   When I needed a variable height renderer, I copied
ListItemRenderer
  and
   modified to my needs. That was the only way I could get it to
work. It
  is
   also *much* more performant than a container based renderer. The
magic
  is
   indeed in the measure() function.
  
  
  
   If you do not have a lot of items to renderer, Repeater works well
  with
   variable heights.
  
  
  
   Tracy Spratt,
  
   Lariat Services, development services available
  
   _
  
   From: flexcoders@yahoogroups.com
[mailto:flexcod...@yahoogroups.com]
  On
   Behalf Of wubac1
   Sent: Saturday, April 18, 2009 2:02 AM
   To: flexcoders@yahoogroups.com
   Subject: [flexcoders] Custom List ItemRenderer / Recycling
troubles
  (height
   incorrect)
  
  
  
  
  
  
  
  
   I'm attempting to create a very simple item renderer for mx:List.
I've
  found
   that when the dataProvider is static, there are no problems with
the
  custom
   item
   renderer. However, when the dataProvider is dynamic, the height of
the
  item
   renderer is not correct (and scroll bars appear for each renderer
with
  any
   meaningful # of rows). I've set variableRowHeight=true for the
List.
  I've
   also tried overriding the measure function and invaliding the size
  when a
   dataChange event is dispatched (based on information provided on
  FlexCoders
   in previous discussions along these lines).
  
   CommentRenderer.mxml:
  
   ?xml version=1.0 encoding=utf-8?
   mx:VBox xmlns:mx=http://www.adobe.
http://www.adobe.com/2006/mxml
   com/2006/mxml width=100%
   mx:Script
   ![CDATA[
   override protected function measure():void
   {
   super.measure();
   measuredHeight = comment.textHeight;
   }
   ]]
   /mx:Script
   mx:LinkButton label={data.commenter.name}/
   mx:Text id=comment width=100% text={data.comment}
   dataChange=invalidateSize()/
   /mx:VBox
  
   The mx:List definition:
  
   mx:List id=comments itemRenderer=com.test.CommentRenderer
  width=100%
   height=100%/
  
   I've looked over the ListItemRenderer, but have so far been unable
to
  glean
   the
   magic sauce that makes the item renderer function correctly when
the
  control
   recycles. Can someone explain / provide a functional example(s)
with
  mx:Text
   (ActionScript and MXML examples preferred, for completeness)?
  
 






RE: [flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread Tracy Spratt
Hah, Tim, your spell didn't quite do it, huh? ;)  Container-based renderers
are problematic.  For anything even slightly complex, extend UIComponent.

 

I copy ListItemRenderer, it is a great starting point.  It is pretty easy to
see where to add your special incantations.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Tim Hoff
Sent: Saturday, April 18, 2009 5:27 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Custom List ItemRenderer / Recycling troubles
(height incorrect)

 







Hi,

Yes, after playing with it a little, you're correct; my suggestion only
works in AS. Sorry, I always extend UIComponent for itemRenderers that
need to have a variableRowHeight.

BTW, in the future, please sign your posts; so that we can put a name to
your warm and positive comments.

-TH

--- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com,
wubac1 wub...@... wrote:

 Tim, I have been using the variableRowHeight (see my original
example). Also, one should not need to replicate the measure of mx:Text.
Your example disregards internal padding elements of the Text component.
I did try setActualSize combined with getExplicitOrMeasuredHeight, but
that only works in ActionScript. I encourage you to try and create a
functional example. I'm fairly confident at this point that you will not
get one working in MXML with mx:Text (multi-line).

 I was able to get a fully functional item renderer based on
ListItemRenderer, which uses UITextField. However, in theory, one should
be able to do it in MXML. With that in mind, I replaced the UITextField
of my ActionScript-based renderer with mx:Text. It's probably not
surprising to many that the renderer no longer behaves as expected. The
height issue appears to be tied to the component in some fashion
(mx:Text in this case). I'd file a defect but I haven't seen much ROI in
such reports.

 --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com,
Tim Hoff TimHoff@ wrote:
 
 
  Hi,
 
  Set the List's variableRowHeight=true and use something like this
in
  the itemRenderer:
 
  override protected function measure():void
  {
  var textLineMetrics:TextLineMetrics = comment.measureText(
  comment.text );
 
  // should add paddingTop, paddingBottom and verticalGap to this too
  measuredHeight = textLineMetrics.height + myLinkButton.height;
  }
 
  -TH
 
  --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com, Tracy Spratt tracy@ wrote:
  
   Sorry, no magic sauce here. I had some pixie dust somewhere, but.
Was
  it
   Asimov or Clark that said, Any sufficiently advanced technology
is
   indistinguishable from magic?
  
  
  
   When I needed a variable height renderer, I copied
ListItemRenderer
  and
   modified to my needs. That was the only way I could get it to
work. It
  is
   also *much* more performant than a container based renderer. The
magic
  is
   indeed in the measure() function.
  
  
  
   If you do not have a lot of items to renderer, Repeater works well
  with
   variable heights.
  
  
  
   Tracy Spratt,
  
   Lariat Services, development services available
  
   _
  
   From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com
[mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com]
  On
   Behalf Of wubac1
   Sent: Saturday, April 18, 2009 2:02 AM
   To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com
   Subject: [flexcoders] Custom List ItemRenderer / Recycling
troubles
  (height
   incorrect)
  
  
  
  
  
  
  
  
   I'm attempting to create a very simple item renderer for mx:List.
I've
  found
   that when the dataProvider is static, there are no problems with
the
  custom
   item
   renderer. However, when the dataProvider is dynamic, the height of
the
  item
   renderer is not correct (and scroll bars appear for each renderer
with
  any
   meaningful # of rows). I've set variableRowHeight=true for the
List.
  I've
   also tried overriding the measure function and invaliding the size
  when a
   dataChange event is dispatched (based on information provided on
  FlexCoders
   in previous discussions along these lines).
  
   CommentRenderer.mxml:
  
   ?xml version=1.0 encoding=utf-8?
   mx:VBox xmlns:mx=http://www.adobe.
http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml
   com/2006/mxml width=100%
   mx:Script
   ![CDATA[
   override protected function measure():void
   {
   super.measure();
   measuredHeight = comment.textHeight;
   }
   ]]
   /mx:Script
   mx:LinkButton label={data.commenter.name}/
   mx:Text id=comment width=100% text={data.comment}
   dataChange=invalidateSize()/
   /mx:VBox
  
   The mx:List definition:
  
   mx:List id=comments itemRenderer=com.test.CommentRenderer
  width=100%
   height=100%/
  
   I've looked over the ListItemRenderer, but have so far been unable
to
  glean
   the
   magic sauce that makes the 

RE: [flexcoders] Reoading a view from a viewstack

2009-04-18 Thread Tracy Spratt
No, a rendered component is rendered and there is no way to 'reload it.  I
suppose you could use a Module or SWFLoader, but that is a heavy-duty
architectural change.

 

Duplicate the init functionality you need in a show event handler.

 

Tracy Spratt,

Lariat Services, development services available

  _  

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Wally Kolcz
Sent: Saturday, April 18, 2009 11:03 AM
To: Flexcoders@yahoogroups.com
Subject: [flexcoders] Reoading a view from a viewstack

 






My application uses a ToggleButtonBar with a viewstack as it's dataprovider.
When the app is first loaded and each component is called in the stack, it
loads the component and runs it's initApp() on the creationComplete. However
when you go back it's already loaded and doesn't run the initApp() and pull
new external data. 

Is there a way to automatically reload the component each time a generated
button is pushed in the ToggleButtonBar? 





[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread Tim Hoff

Yep, no magic here. :)

-TH

--- In flexcoders@yahoogroups.com, Tracy Spratt tr...@... wrote:

 Hah, Tim, your spell didn't quite do it, huh? ;) Container-based
renderers
 are problematic. For anything even slightly complex, extend
UIComponent.



 I copy ListItemRenderer, it is a great starting point. It is pretty
easy to
 see where to add your special incantations.



 Tracy Spratt,

 Lariat Services, development services available

 _

 From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
On
 Behalf Of Tim Hoff
 Sent: Saturday, April 18, 2009 5:27 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Custom List ItemRenderer / Recycling
troubles
 (height incorrect)









 Hi,

 Yes, after playing with it a little, you're correct; my suggestion
only
 works in AS. Sorry, I always extend UIComponent for itemRenderers that
 need to have a variableRowHeight.

 BTW, in the future, please sign your posts; so that we can put a name
to
 your warm and positive comments.

 -TH

 --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com,
 wubac1 wubac1@ wrote:
 
  Tim, I have been using the variableRowHeight (see my original
 example). Also, one should not need to replicate the measure of
mx:Text.
 Your example disregards internal padding elements of the Text
component.
 I did try setActualSize combined with getExplicitOrMeasuredHeight, but
 that only works in ActionScript. I encourage you to try and create a
 functional example. I'm fairly confident at this point that you will
not
 get one working in MXML with mx:Text (multi-line).
 
  I was able to get a fully functional item renderer based on
 ListItemRenderer, which uses UITextField. However, in theory, one
should
 be able to do it in MXML. With that in mind, I replaced the
UITextField
 of my ActionScript-based renderer with mx:Text. It's probably not
 surprising to many that the renderer no longer behaves as expected.
The
 height issue appears to be tied to the component in some fashion
 (mx:Text in this case). I'd file a defect but I haven't seen much ROI
in
 such reports.
 
  --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com,
 Tim Hoff TimHoff@ wrote:
  
  
   Hi,
  
   Set the List's variableRowHeight=true and use something like
this
 in
   the itemRenderer:
  
   override protected function measure():void
   {
   var textLineMetrics:TextLineMetrics = comment.measureText(
   comment.text );
  
   // should add paddingTop, paddingBottom and verticalGap to this
too
   measuredHeight = textLineMetrics.height + myLinkButton.height;
   }
  
   -TH
  
   --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com, Tracy Spratt tracy@ wrote:
   
Sorry, no magic sauce here. I had some pixie dust somewhere,
but.
 Was
   it
Asimov or Clark that said, Any sufficiently advanced technology
 is
indistinguishable from magic?
   
   
   
When I needed a variable height renderer, I copied
 ListItemRenderer
   and
modified to my needs. That was the only way I could get it to
 work. It
   is
also *much* more performant than a container based renderer. The
 magic
   is
indeed in the measure() function.
   
   
   
If you do not have a lot of items to renderer, Repeater works
well
   with
variable heights.
   
   
   
Tracy Spratt,
   
Lariat Services, development services available
   
_
   
From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com
 [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com]
   On
Behalf Of wubac1
Sent: Saturday, April 18, 2009 2:02 AM
To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
ups.com
Subject: [flexcoders] Custom List ItemRenderer / Recycling
 troubles
   (height
incorrect)
   
   
   
   
   
   
   
   
I'm attempting to create a very simple item renderer for
mx:List.
 I've
   found
that when the dataProvider is static, there are no problems with
 the
   custom
item
renderer. However, when the dataProvider is dynamic, the height
of
 the
   item
renderer is not correct (and scroll bars appear for each
renderer
 with
   any
meaningful # of rows). I've set variableRowHeight=true for the
 List.
   I've
also tried overriding the measure function and invaliding the
size
   when a
dataChange event is dispatched (based on information provided on
   FlexCoders
in previous discussions along these lines).
   
CommentRenderer.mxml:
   
?xml version=1.0 encoding=utf-8?
mx:VBox xmlns:mx=http://www.adobe.
 http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml
com/2006/mxml width=100%
mx:Script
![CDATA[
override protected function measure():void
{
super.measure();
measuredHeight = comment.textHeight;
}
]]
/mx:Script
mx:LinkButton label={data.commenter.name}/
mx:Text id=comment width=100% text={data.comment}
dataChange=invalidateSize()/
/mx:VBox
   
   

[flexcoders] Re: Custom List ItemRenderer / Recycling troubles (height incorrect)

2009-04-18 Thread wubac1

Well, there is magic in ActionScript.  MXML doesn't have the item renderer mojo.

-W

--- In flexcoders@yahoogroups.com, Tim Hoff timh...@... wrote:

 
 Yep, no magic here. :)
 
 -TH
 
 --- In flexcoders@yahoogroups.com, Tracy Spratt tracy@ wrote:
 
  Hah, Tim, your spell didn't quite do it, huh? ;) Container-based
 renderers
  are problematic. For anything even slightly complex, extend
 UIComponent.
 
 
 
  I copy ListItemRenderer, it is a great starting point. It is pretty
 easy to
  see where to add your special incantations.
 
 
 
  Tracy Spratt,
 
  Lariat Services, development services available
 
  _
 
  From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
 On
  Behalf Of Tim Hoff
  Sent: Saturday, April 18, 2009 5:27 PM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Re: Custom List ItemRenderer / Recycling
 troubles
  (height incorrect)
 
 
 
 
 
 
 
 
 
  Hi,
 
  Yes, after playing with it a little, you're correct; my suggestion
 only
  works in AS. Sorry, I always extend UIComponent for itemRenderers that
  need to have a variableRowHeight.
 
  BTW, in the future, please sign your posts; so that we can put a name
 to
  your warm and positive comments.
 
  -TH
 
  --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com,
  wubac1 wubac1@ wrote:
  
   Tim, I have been using the variableRowHeight (see my original
  example). Also, one should not need to replicate the measure of
 mx:Text.
  Your example disregards internal padding elements of the Text
 component.
  I did try setActualSize combined with getExplicitOrMeasuredHeight, but
  that only works in ActionScript. I encourage you to try and create a
  functional example. I'm fairly confident at this point that you will
 not
  get one working in MXML with mx:Text (multi-line).
  
   I was able to get a fully functional item renderer based on
  ListItemRenderer, which uses UITextField. However, in theory, one
 should
  be able to do it in MXML. With that in mind, I replaced the
 UITextField
  of my ActionScript-based renderer with mx:Text. It's probably not
  surprising to many that the renderer no longer behaves as expected.
 The
  height issue appears to be tied to the component in some fashion
  (mx:Text in this case). I'd file a defect but I haven't seen much ROI
 in
  such reports.
  
   --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com,
  Tim Hoff TimHoff@ wrote:
   
   
Hi,
   
Set the List's variableRowHeight=true and use something like
 this
  in
the itemRenderer:
   
override protected function measure():void
{
var textLineMetrics:TextLineMetrics = comment.measureText(
comment.text );
   
// should add paddingTop, paddingBottom and verticalGap to this
 too
measuredHeight = textLineMetrics.height + myLinkButton.height;
}
   
-TH
   
--- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
  ups.com, Tracy Spratt tracy@ wrote:

 Sorry, no magic sauce here. I had some pixie dust somewhere,
 but.
  Was
it
 Asimov or Clark that said, Any sufficiently advanced technology
  is
 indistinguishable from magic?



 When I needed a variable height renderer, I copied
  ListItemRenderer
and
 modified to my needs. That was the only way I could get it to
  work. It
is
 also *much* more performant than a container based renderer. The
  magic
is
 indeed in the measure() function.



 If you do not have a lot of items to renderer, Repeater works
 well
with
 variable heights.



 Tracy Spratt,

 Lariat Services, development services available

 _

 From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
  ups.com
  [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com]
On
 Behalf Of wubac1
 Sent: Saturday, April 18, 2009 2:02 AM
 To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com
 ups.com
 Subject: [flexcoders] Custom List ItemRenderer / Recycling
  troubles
(height
 incorrect)








 I'm attempting to create a very simple item renderer for
 mx:List.
  I've
found
 that when the dataProvider is static, there are no problems with
  the
custom
 item
 renderer. However, when the dataProvider is dynamic, the height
 of
  the
item
 renderer is not correct (and scroll bars appear for each
 renderer
  with
any
 meaningful # of rows). I've set variableRowHeight=true for the
  List.
I've
 also tried overriding the measure function and invaliding the
 size
when a
 dataChange event is dispatched (based on information provided on
FlexCoders
 in previous discussions along these lines).

 CommentRenderer.mxml:

 ?xml version=1.0 encoding=utf-8?
 mx:VBox xmlns:mx=http://www.adobe.
  http://www.adobe. http://www.adobe.com/2006/mxml com/2006/mxml
 

[flexcoders] Lightweight framework

2009-04-18 Thread Dnk
Go there,

I know there have been a billion topics regarding frameworks on here.  
I have been using cairngorm for a while and do like it. Now after  
doing a few projects, I have come to the realization that pretty much  
all projects I do are small - med with remoting. Cairngorm when  
looking back at it, seems like overkill with a lot of code (for  
projects my size- just hobby and personal projects).

I like the code structure of frameworks and the advantages they offer,  
but I just want to simplify a bit.

But I am curious if anyone can recommend a light weight framework?

D






[flexcoders] Re: Lightweight framework

2009-04-18 Thread zuurl8
Flex is a lightweight framework.  Do you need more then what Flex provides in 
interface, events, and modules?

--- In flexcoders@yahoogroups.com, Dnk d.k.emailli...@... wrote:

 Go there,
 
 I know there have been a billion topics regarding frameworks on here.  
 I have been using cairngorm for a while and do like it. Now after  
 doing a few projects, I have come to the realization that pretty much  
 all projects I do are small - med with remoting. Cairngorm when  
 looking back at it, seems like overkill with a lot of code (for  
 projects my size- just hobby and personal projects).
 
 I like the code structure of frameworks and the advantages they offer,  
 but I just want to simplify a bit.
 
 But I am curious if anyone can recommend a light weight framework?
 
 D