2 Replies Latest reply on Jun 17, 2011 5:12 AM by relaxatraja

    Making a Quiz in Flash. Need help with input time

    Namilian

      Hi Flash Community,

       

      I'm making currently a quiz using Flash Pro CS5. What I want to implent is a time bar which will load once the bar is loaded it will go to the next frame.

       

      So what I need is first a timer which will start immediately when the user sees the question and I need a time bar which will indicate how far the timing is. So let's say you have 30 seconds to answer the quiz. When the timer is at 15 seconds the bar will be at half.

       

      Something like this http://www.google.nl/imgres?imgurl=http://theportablegamer.com/wp-content/uploads/2009/10/ question.jpg&imgrefurl=http://theportablegamer.com/tag/quizquizquiz/&usg=__xsykgRnehmB9P97 gg3W9tAx2Dfg=&h=320&w=480&sz=57&hl=nl&start=0&sig2=tdKlW2Iv6zHo3THsHwdVpQ&zoom=1&tbnid=ToM bL22o-D7BOM:&tbnh=107&tbnw=160&ei=aiz7TcGONI2gOpic0b4E&prev=/search%3Fq%3Dquiz%2Binterface %26um%3D1%26hl%3Dnl%26sa%3DN%26biw%3D1902%26bih%3D909%26tbm%3Disch&um=1&itbs=1&iact=rc&dur =317&page=1&ndsp=68&ved=1t:429,r:13,s:0&tx=100&ty=47

       

      Could anyone help me with this? How do I need to do this?

       

      Thanks!

        • 1. Re: Making a Quiz in Flash. Need help with input time
          renatobox

          you could make a bar that moves by orders of the timer. For exemple, every half second the bar moves in the X axis. You sould calculate that with the position of the bar and the maximum position of the bar(time out).

          • 2. Re: Making a Quiz in Flash. Need help with input time
            relaxatraja Level 5

            Create a movieclip with tween about 30 frames and actions stop() in the first frame

             

            AS3 code:

             

            import flash.utils.Timer;

             

            var timer:Timer=new Timer(1000);
            timer.addEventListener(TimerEvent.TIMER,fn);
            timer.start();

             

            function fn(e:TimerEvent):void{
                trace(mc.currentFrame);
                if (mc.currentFrame==30){
                    timer.removeEventListener(TimerEvent.TIMER,fn);
                }
                mc.gotoAndStop(mc.currentFrame+1);
            }

             

            AS2 code:

             

            var n=setInterval(mcfn,1000);
            function mcfn(){
                trace(mc._currentframe);
                if (mc._currentframe==30){
                    clearInterval();
                }
                mc.gotoAndStop(mc._currentframe+1);
            }