TDOT Blog Touchwood Creative

Register | Forgot password?

Author Info

Name
Ben Bishop

Job Title
Senior Interactive Developer



Touchwood is continuing to grow!

We are looking for talented Flex developers to join our Interactive Group. If you have any interest we would love to meet you. Please email your resume to us at:

jobs@touchwoodcreative.com


Uniform Link Widths in Flex's LinkBar Component

Problem:

You want the links in the LinkBar component to be the same width.

Solution:

Extend the LinkBar component to have a property called "linkWidth."

public class UniformLinkBar extends LinkBar

{

[Bindable]
public var linkWidth:Number = 50;

Override the createChildren method. In this method bind the new "linkWidth" property to each child's width.

override protected function createChildren():void{

super.createChildren();
for(var i:int = 0; i < this.numChildren; i++){

BindingUtils.bindProperty(getChildAt(i), "width", this, "linkWidth");

}

}

To Implement:

<components:UniformLinkBar linkWidth="100">

Attached is the library project.

AttachmentSize
UniformLinkBar.zip404.01 KB
© Touchwood Creative 2007 | We use Firefox