Hi,
Your Timer delay is possibly too small to be reliable - in the
documentation it says that a timer delay lower than 20ms is not recommented:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/utils/Timer.html#Timer%28%29
If you then start a loop to trace 1000 times during a timer event,
this will slow down your system whilst the loop runs...
What is probably happening is that your flag_loop variable is set
to true again before the loop has finished.
My question is why do you need timer3 to test the "step" variable -
can't you do that in Timer1? Also timer2 seems pretty redundant - could
you run a single timer that tests various conditions instead?
HTH
Glen
On 08/09/2011 13:50, New Flashdeveloper wrote:
Hi
I am student , I’m new in flash .In My Project I need to
have timer that work correctly with out
depending on other process in my project
. Please look at the attachment , one
timer worl alone another work and have condition , when we get the condition
the timers work slowly , I don’t know why is that and how can I solve it and
have independent timer . I test it when
we need to work with loop or other thing the timer stop working even the timers
that aren’t related to it ?????????????????
I have foure text box inside stage (i cant attach file because of limited size
in site)
import flash.utils.Timer;
import flash.events.TimerEvent;
var i :int
var flagloop:Boolean=false;
var step:Number=0
var startTime :Number=getTimer()
var timer1:Timer=new Timer(1)
timer1.start()
timer1.addEventListener(TimerEvent.TIMER,Func_time1)
function Func_time1(e:TimerEvent):void
{
timer1txt.text=String(step)
step +=0.001
}
/////Timer 2vvvvvvvvvvvv
var timer2:Timer=new Timer(1)
timer2.start()
timer2.addEventListener(TimerEvent.TIMER,Func_time2)
function Func_time2(e:TimerEvent):void
{
timer2txt.text=e.target.currentCount
gettimertxt.text=String((getTimer()- startTime))
//e.updateAfterEvent();
flagloop=true
}
//vvvvvvvvvvvvvvvvvv/////Timer 2
var timer3:Timer=new Timer(1)
timer3.start()
timer3.addEventListener(TimerEvent.TIMER,Func_time3)
function Func_time3(e:TimerEvent):void
{
timer3txt.text=e.target.currentCount
if((step>2)&& (step<2.25))
{
if(flagloop== true)
{
testTimer()
}
}
}
///////vvvvvvvvvv////
function testTimer():void
{
flagloop=false
for(i=0;i<1000;i++)
{
trace("Hello World")
}
flagloop=true
}
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders