Monday, March 29, 2010

How to use a link bar or navigation bar...

My app has a link bar in an Application Control bar that is bound to the view stack of the steps in my application.

I would like to use this as a mechanism to show the user which step he is on and how many are left, but NOT to click on it to navigate between steps.聽 I have provided wizard-like buttons to step navigation.

How can I have the link bar not respond to clicks, or, if not, programmatically disable certain steps in it (e.g. ''step 2'' not available until I say so)?

How to use a link bar or navigation bar...

OK, I have decided it might be easier to use a repeater with buttons in it, such as:

%26lt;mx:Repeater id=''toolbar'' dataProvider=''{dataXML}'' %26gt;

%26lt;mx:Button label=''{toolbar.currentIndex+1}. {toolbar.currentItem..stepTitle}'' enabled=''false'' /%26gt;

%26lt;/mx:Repeater%26gt;

So now I'd like to progressively change the buttons in the repeater to ''enabled'' as I am ready.

However, toolbar.getChildAt(0).enabled = true fails with:

1119: Access of possibly undefined property enabled through a reference with static type flash.display:DisplayObject.

How to use a link bar or navigation bar...

Never mind, I eventually figured it out:

I had to give the button an id which apparently creates an array of the same name:%26lt;mx:Button id=''toolbarButtons'' enabled=''false'' /%26gt;

So to enable it: toolbarButtons[0].enabled = true;

No comments:

Post a Comment