Friday, April 2, 2010

dynamically resizing itemrenderer

Hi,

Can anyone give me a few hints or point me to some sample code that will dynamically (and ideally, smoothly) resize a custom itemrenderer in a tileList component?

I currently have a tileList with a custom itemRenderer that extends vbox.?It is a very simple component consisting of a Image and a label below it.?Elsewhere in my app I have a Hslider that I would like to use to set the 'zoom' on my tileList (so resizing my custom itemRenderer).

As a first step I would like the images to resize smoothly, but another wrinkle is as the images become bigger (or smaller), I will need the tileList to dynamically change the number of columns displayed.

Any hints or pointers would be appreciated.

Thanks,

Cliff

dynamically resizing itemrenderer

unfortnatly that is not possible.

a trick that you can do is to have a component that looks as your itemRenderer and then when you do a mouseOver on your place the ''fake'' itemRender over your real one on the tileList, and them you can do whatever animation you need.

Rigth now I working on something like that, so as soon i have that working well I let you know.

If anybody have a better aproach i will like to know as well

Regards.

dynamically resizing itemrenderer

I have found some code to do it.?It's not perfect, but it works pretty well.?I followed the lead of this guy here:

http://blog.flexmonkeypatches.com/2009/01/20/poor-mans-zooming-flex-tilelist/

I did something like this:

//http://www.actionscript.org/forums/showthread.php3?t=116021

private function sliderChange(target:TileList, event:SliderEvent):void {

var currentSlider:Slider=Slider(event.currentTarget);

target.columnCount = Math.floor(target.width/currentSlider.value);

target.rowCount= Math.floor(target.height/currentSlider.value);

target.columnWidth = currentSlider.value;

target.rowHeight = currentSlider.value;

}

and this:

%26lt;mx:HSlider liveDragging=''true''

id=''dim''

value=''25''

tickInterval=''5''

snapInterval=''5''

labels=''['0', '100']''

minimum=''25''

maximum=''200''

change=''sliderChange(mapTileList,event)''/%26gt;

No comments:

Post a Comment