Instead of states, you can use a little binding, like:
mx:Text x=10 y=10 text={ScriptsAccordion.selectedChild.label}
Page Text width=218 id=text1/
Or, create an Array that contains the text that you want to display,
in the same order as the Accordion children. You would then
similarly bind like:
text={myArray[ScriptsAccordion.selectedIndex]}
-TH
--- In flexcoders@yahoogroups.com, Impudent1 [EMAIL PROTECTED] wrote:
I have been playing with flex a bit lately, doing the tutorials,
some
web examples from the blogs (ty all ;p )
I decided to try to rebuild a basic web page that currently lists
all
the scripts I created for After Effects in Flex2B3.
What I am stuck on is trying to have an accordion navigator change
the
content in a specific canvas. I currently have setup states to do
this.
Thinking that I would be able to setup a function that would test
the
accordions selected id vs a list of states and change accordingly
I
setup the following:
?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml;
layout=absolute
mx:states
mx:State name=BackBurnerSubmitUI
mx:SetProperty target={text1} name=text
value=Backburner page text/
/mx:State
mx:State name=BackupProject
mx:SetProperty target={text1} name=text
value=BackupProject page text/
/mx:State
mx:State name=Calc
mx:SetProperty target={text1} name=text
value=Calc
page text/
/mx:State
mx:State name=DefaultFolders
mx:SetProperty target={text1} name=text
value=Default
Folders page text/
/mx:State
mx:State name=DropFootageTime0
mx:SetProperty target={text1} name=text
value=DropFootage page text/
/mx:State
mx:State name=FilmCalc
mx:SetProperty target={text1} name=text
value=Filmcalc page text/
/mx:State
mx:State name=FontCollector
mx:SetProperty target={text1} name=text
value=Font
collector page text/
/mx:State
mx:State name=GoWarpStatic
mx:SetProperty target={text1} name=text
value=Gowarp
page text/
/mx:State
mx:State name=Gspot
mx:SetProperty target={text1} name=text
value=Gspot
page text/
/mx:State
mx:State name=ImportExportLayouts
mx:SetProperty target={text1} name=text
value=Layouts
page text/
/mx:State
mx:State name=ImportExportMRU
mx:SetProperty target={text1} name=text
value=MRU
page text/
/mx:State
mx:State name=MusterBatchUI
mx:SetProperty target={text1} name=text
value=Musterbatch page text/
/mx:State
mx:State name=MusterSubmitUI
mx:SetProperty target={text1} name=text
value=Mustersubmit page text/
/mx:State
mx:State name=RenderAndShutdown
mx:SetProperty target={text1} name=text
value=Rendershutdown page text/
/mx:State
mx:State name=SamplerSizerRadio
mx:SetProperty target={text1} name=text
value=Samplersizer page text/
/mx:State
/mx:states
mx:Script
![CDATA[
// Import the class that defines the event object.
import mx.events.IndexChangedEvent;
// set the function
private function
ScriptsAccChange(event:IndexChangedEvent):void {
// set the state to fit the accordion index
if(event.newIndex ==
1){currentState='BackBurnerSubmitUI'}
}
]]
/mx:Script
mx:Accordion x=10 y=55 width=240
resizeToContent=true
id=ScriptsAccordion change=ScriptsAccChange(event)
mx:Canvas label=Main Page width=100% height=0
id=MainPage
/mx:Canvas
mx:Canvas label=Backburner Submit UI width=100%
height=100%
mx:Label x=10 y=10 text=Version/
mx:Label x=85 y=10 text=Date/
mx:Label x=148 y=10 text=Description/
mx:Label x=20 y=35 text=1.0/
mx:Label x=64 y=36 text=18, 7, 2004/
mx:Label x=156 y=36 text=AE 6.5 +/
mx:HRule x=10 y=10 width=220 height=36/
/mx:Canvas
mx:Canvas label=Backup Project width=100%
height=100%
mx:Label x=10 y=10 text=Version/
mx:Label x=85 y=10 text=Date/
mx:Label x=148 y=10 text=Description/
mx:Label x=23 y=35 text=1.0/
mx:Label x=64 y=35 text=17, 7, 2004/
mx:Label x=156 y=35 text=AE 6.5 +/
mx:Label x=23 y=50 text=1.2/
mx:Label x=64 y=50 text=28, 1, 2006/
mx:Label x=166 y=50 text=AE 7/
mx:HRule x=10 y=10 width=220 height=36/
/mx:Canvas
mx:Canvas label=Calc width=100% height=100%