This content has been marked as final. Show 9 replies
Will you post some of you code? selectedIndex on Accordion seems to be working in the Beta 3 build. Here is some code that I just tried out and it is working:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
<mx:Accordion id="myAccord" height="200">
<mx:TextInput id="ti" text="" />
<mx:Button label="zero button" />
<mx:TextInput id="ti2" text="" />
It turns out that if I launch from Flex Builder, the accordion will open to selectedIndex for a split second, then revert back to the default state. However, if I launch my app from a URL (i.e. navigate to it directly), it opens up to selectedIndex and stays there, as desired.
I'm not having any luck reproducing your problem. I tried the sample code
that Joan posted, and it works fine no matter how it is launched.
Can you post sample code that demonstrates the problem?
Developer, Flex Builder team
> It turns out that if I launch from Flex Builder, the accordion will open to
> selectedIndex for a split second, then revert back to the default state.
> However, if I launch my app from a URL (i.e. navigate to it directly), it opens
> up to selectedIndex and stays there, as desired.
My problem persists, and here is the deal:
If I create an accordion and specify a value for the SelectedIndex property, the accordion will open to that selected index when the app is launched. However, if I do not specify a value for the property, it will default to show the first tab (index 0) open.
Now, if I do some initialization by adding something like creationComplete="initializeApp()" in the mx:Application line, and within initializeApp() I specify myAccordion.selectedIndex=1, then the problem appears. The application appears with tab 0 open, then suddenly tab 1 opens, then suddenly tab 0 opens again. It is as if some accordion initialization code is being executed twice, or is being executed AFTER my function is called (as if the creationComplete event is being handled first - and maybe it is).
Is there some way to defer my initialization code until Flex init is complete, or to get Flex to allow my init code to override the default selectedIndex value?
Is you creation complete event on your accordion or on your main app? Basically any component, including the application, can have an associated creationComplete event.
I have placed the code in the creationComplete event in either or BOTH the application and accordion control declarations and the effect is the same. The accordion opens to the desired tab for a split second, then the default tab (0) opens.
Post a sample app.
Last week all I had to do was add creationComplete="myAcc.selectedIndex=1" to either the accordion or to the application to demonstrate the problem. Today, I cannot recreate the problem - anywhere. Even in the app where the problem has been notorious. This is bothersome as this indicates an intermittent problem. The only thing that has changed between then and now is that I allowed the windows update to take place after it has been barking at me for so long to do.
Now, today, the problem is appearing all over the place - and on more than one computer. Apparently, it only happens the first time the app is launched - subsequent reloads opens the accordion to the proper location - something to do with the cache?
Currently, on my accordion, I have selectedIndex="1" in the attributes, and in the application, I have creationComplete calling a handler that sets accInfo.selectedIndex=1 in AS3. I have tried every permutation of ways to set selectedIndex to 1 and the results have never varied.