Hey there Wally,

You can get access to the currently selected viewstack, and also set it, 
through selectedIndex. So your initial declaration would be like
<mx:ViewStack id="questionVS" etc... selectedIndex="0" 
click="nextQuestion()">

and in your function nextQuestion you can increment the selectedIndex. 
I'd have to check but I think you can find the number of items in your 
viewStack with numChildren. That would give you your max value to finish 
your quiz or handle the end how you would like.

You can find more about what you can do with viewstacks in the docs:

http://livedocs.adobe.com/flex/3/langref/mx/containers/ViewStack.html

Hope that helps!

Michael

Wally Kolcz wrote:
>
> I have a test that I want to walk through the questions using a 
> function. How can I set the inital value of the ViewStack 
> (questionsVS) to 0 and then increment it by one each time someone 
> clicks a button?
>
> <mx:ViewStack id="questionsVS" width="98%" height="100%" paddingLeft="10">
>         <questions:question1 />
>         <questions:question2 />
>         <questions:question3 />
>         <questions:question4 />
>     </mx:ViewStack>
>
> 

Reply via email to