Flex 3 LinkButton width: Distorted Skin Image - apache-flex

I am using linkButtons with a background skin inside a linkBar with a dataProvider. A couple of the labels from the linkButtons are too long and distort the linkButton skin. How can I make all of the linkButtons labels the same width?

You can use an item renderer to render a set of data the way you wish.
You can include most of the components in custom renderers.
Check out the following articles
http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html
and
http://www.switchonthecode.com/tutorials/flex-using-item-renderers
Hope that helps!
Cheers,
Ernani

If you want the width to be based on the text then you have to pre-measure your text to figure out the max width and then pass that width into the itemRenderers.

Related

Flex ItemRenderer - how to tell when it's being reused?

I'm using a spark ItemRenderer in a list with useVirtualLayout="true"
The itemRenderer has an image loaded in it.
When the list scrolls, and a new Item is brought into view - the image flickers, briefly showing the previous image in the itemrenderer.
When the itemrenderer is re-used, how can I prevent the flicker?
Is there an event when an itemrenderer is discarded? then I could hide the image or load a blank image.
Try this
A simple way to avoid Flickering images is to give a height according to the total images to show
example
if the List have vertical layout
myList.height = myList.dataProvider.length;
if the List have horizontal layout
myList.width = myList.dataProvider.length;
It depends on how you use the image. I tend to load the image and save its BitmapData ONCE!. Then you can directly use it without any flickering. You just have to inject some sort of ImageRespository into the renderer.
This can easily be done by listing to the rendererAdd event of the DataGroup and stuff the repo into the renderer.

aspx radiobutton control list in one line

http://www.codetoad.com/asp.net/aspnetcontrols11.asp
Is it possible to have radiobutton control list in one row. Now it is in 3 rows.
You need to use the RepeatDirection and RepeatLayout properties of the RedioButtonList control.
There are several ways of getting the layout you want - I suggest reading the documentation of both properties in order to make an informed decision on which one is most suitable for your situation.
In your RadioButtonList set the property of RepeatLayout="Flow" and RepeatDirection="Horizontial". This will make items in a radio button list horizontal instead of vertical.
Why dont you try adding each radio button to <div> or <li> tag and then set float:left in Css for each <li>. That way i think it will render in one line. Just make sure to set width:__ style to accommodate all radio buttons

flex custom itemRenderer doesn't use the styles specified

I have a custom item renderer which I use for my DataGrid. The DataGrid has specified selectionColor, rollOverColor and themeColor. The Problem is that the custom item renderer, does ignore those colors, and doesn't give any Feedback...
I tried to add the lines:
setStyle("selectionColor", 0xEDF1F7);
setStyle("rollOverColor", 0xE1F5DE);
setStyle("themeColor", 0x3569B0);
But with no effect...
Who can help on that?
Thanks,
Markus
Those styles won't apply to the component you are using for your itemRenderer (which you don't mention). They're styles of the DataGrid itself.
So let's say you're using a Canvas. Try setting the backgroundAlpha of the Canvas to 0.0 so that your DataGrid's selection and other colors will show through.

Change size of checkbox in Flex

In Flex, is there an easy way to change the size of a Checkbox? I want to make the checkbox bigger, but the label beside it the same font size. Thanks!
I've used scaleX and scaleY. I think the syntax is scaleX="1.5" scaleY="1.5" to make it 50% larger.
I would imagine you could programatically skin the checkbox but ive never done it. Just increase the w and h passed in from the updateDisplayList(w:Number, h:Number) function when creating a programmatic skin.
Another option, albiet rather hacky, would be to make a custom control. A canvas, a label for the checkbox text and an image for the actual "check". Click on the image, if its checked it shows your unchecked image and vice versa.

Flex: Adding selectable image on canvas

I am new to flex, and do not know how to add an image (or other ui component) to canvas, so user can select it (and see that it's selected), also I want to add a possibility for example to click backspace and remove selected image from scene. How to do that?
Maybe you can point me to a doc to read?
I am not sure what you exactly need.
Do you need to add one image to the canvas, or possibly multiple?
And how do you need to lay out these images? Horizontal? Vertical? Tiled?
One way of doing it could be to add a TileList to your canvas, and as dataprovider an ArrayCollection that holds the sources of the images you need.
Create an itemrenderer for the List or TileList and you will be able to display the images.
The images will then be selectable. When you add an eventListener to the keyDown event you can catch the backscpace button being clicked and remove the selected item from the tilelist.
<mx:TileList id="myTileList" dataProvider="{myImages}" itemRenderer="your.domain.MyItemRenderer" keyDown="{keyDownHandler(event)}" />
Adobe LiveDocs and a few of the words I used in this answer might help you further.
Hope this helps.

Resources