0 Replies Latest reply on Jun 26, 2012 3:34 PM by diddippi

    SetInterval function question


      Hello, i'm using 4.6.


      I have a video that runs on autoplay and i have to set an interval of i.e. 30 seconds at the end of which if i do nothing i.e. for 10 seconds that video resumes and do this in a loop of 5,6, 10 times 'til i want to.


      I made this code but i don't know what i have precisely to do


      private var interval:uint;

      var minuteTimer:Timer = new Timer(1000, 10);

      public function _onCreationComplete():void {

      minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);



      public function onTimerComplete(event:TimerEvent):void {



      choiceone.source = ("assets/play.jpg");

      choicetwo.source = ("assets/stop.jpg");


      public function makeChoiceOne():void {



      public function makeChoiceTwo():void {



      The MXML part


      <s:Image id="choiceone" x="50" y="200" width="50" height="50" click="makeChoiceOne()" />

      <s:Image id="choicetwo" x="150" y="200" width="50" height="50" click="makeChoiceTwo()" />


      So the interval starts and play for ten seconds and then it stops and interval go in standby. Then i have two choices, if i press the key i start the video again.


      How instead to make a loop of onTimerComplete function without writing 5 or 6 or 10 different variables or switch cases?


      Thanks in advance.


      I don't know how to say it but i want that if i do nothing the circle starts again. How say it to the script?