Hi,

I've got it working with the following sample code. I just made a
slight change to your startInterval method to reference the calling
object (this).

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>

  <mx:Script>
  <![CDATA[
        
    var accint:Number;

    function startInterval():Void
    {           
        accint = setInterval( this, 'changeAccordian', 5000 );
    }

    function changeAccordian():Void
    {
        if ( services2.selectedIndex > 0 )
        {
            services2.selectedIndex--;
        }
        else
        {
            stopInterval();
        }
    }

    function stopInterval():Void
    {
        clearInterval( accint );
    }
                
  ]]>
  </mx:Script>
        
  <mx:Accordion id="services2" creationComplete="startInterval()"
    width="100%" height="100%" selectedIndex="2">
                
    <mx:Box label="Page 1" width="100%" height="100%" />
                
    <mx:Box label="Page 2" width="100%" height="100%" />
                
    <mx:Box label="Page 3" width="100%" height="100%" />
                
  </mx:Accordion>

</mx:Application>


--- In flexcoders@yahoogroups.com, "davidgdean" <[EMAIL PROTECTED]> wrote:
> I have a 3 part accordian control.  The accordian is in a component 
> that loads in a vstack (not the default).  When I load it, I want 
> the accordian to start with the selectedIndex=2, then every five 
> seconds, show the next accordian until I get to selectedIndex = 0.  
> When the control loads, I successfully get the control to go from 
> selected index 2-1, but the interval never fires again.
> 
> Listed below is my code.  If anyone can point out what I'm missing, 
> I'd appreciate it.
> 
> creationComplete of the component VBox calls startInterval()
> 
> var accint:Number;
>       
>       function startInterval():Void 
>       {
>               
>               accint=setInterval(changeAccordian(),5000);     
>       
>       }
>       
>       function changeAccordian():Void
>       {
>               if (services2.selectedIndex>0) 
>               {
>               services2.selectedIndex--;              
>               
>               }
>               else
>               {
>               
>                       stopInterval();
>               }
>       }
>       
>       function stopInterval():Void
>       {
> 
>               clearInterval(accint);
> 
>       }




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to