I Cant understannnnnnnnnnnnd
why is that
when the timer start it should work independence any thing 
but it wait for finish th loop
can u explain the timer and loop i know them but i cant understand how they 
work and has an effect on cpu

--- On Mon, 8/29/11, Cor <c...@chello.nl> wrote:

From: Cor <c...@chello.nl>
Subject: RE: [Flashcoders] loop and Timer problem?????????
To: "'Flash Coders List'" <flashcoders@chattyfig.figleaf.com>
Date: Monday, August 29, 2011, 2:44 PM

TRY THIS:


var forsate,generalFlag:Boolean;
var counter:int=0;
var generalTimer:Timer=new Timer(1);
generalTimer.addEventListener(TimerEvent.TIMER,generalfunc);

//NOW IT IS SET
//UN COMMENT THE LINE BELOW TO NOTICE THE DIFFENCE
//generalFlag=true;

testhalgheh();

function generalfunc(e:TimerEvent=null):void {
    generalFlag=true;
    //trace( " generalFlag " + generalFlag)
}

function testhalgheh():void {    
    generalTimer.start();
    //generalFlag IS FALSE AT THIS MOMENT, BECAUSE THE generalfunc IS NOT YET 
CALLED
    while (counter<1000) {
        if (generalFlag==true) {
            trace("hello");
            counter++;
        }
    }
}


_______________________________________________
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

Reply via email to