Re: [Flashcoders] can flash do more than one thing in thr same time

2011-09-21 Thread Kerry Thompson
nasim h wrote:

> 1)  I dont know why the timer counter slow down when the loop start
> working?
>
> how can i solve it
>
> 2)
>
> My bigest Problem is , why flash speed goes down , during this program, Is 
> this
> correct that some people said flash can not do more than one thing in same
> time? other languages like vb has the property applicationdoevent , that it
> update event and timers,or other process doesent affect each other , but in
> flash if u see hthe proccess has affect on each other , the cpu usage goes up 
> ,
> frame rate goes down 

Didn't we go through this last week?

You have a timer trying to fire 1,000 times per second. It takes
longer than 1/1000 second to write to the text field and update it. Of
course the timer slows down.

Flash is not multi-threaded, which means it can do only one thing at a
time. I've heard some talk that there is a new version of the Flash
player that will handle multiple threads, but as it stands now, there
is no way to make your program work faster except to call the timer
less often.

Try new Timer(100), which will fire 10 times per second. Then your
text might be able to keep up with the timer. It depends on a lot of
things--your cpu speed, how many processes are running, and other
factors. The only thing I can pretty much guarantee is that you're not
going to get a timer to fire 1,000 times a second, at least not if
you're doing anything when it fires.

Cordially,

Kerry Thompson

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] can flash do more than one thing in thr same time

2011-09-21 Thread nasim hhhhh




Dear Friend

hi

1)  I dont know why the timer counter slow down when the loop start
working?

how can i solve it

2)

My bigest Problem is , why flash speed goes down , during this program, Is this
correct that some people said flash can not do more than one thing in same
time? other languages like vb has the property applicationdoevent , that it
update event and timers,or other process doesent affect each other , but in
flash if u see hthe proccess has affect on each other , the cpu usage goes up ,
frame rate goes down 

how can i solve it, is there equal instruction  (applicationdoevent in vb
)that we can do it in as3?

 



please help me

 

 

code:

import flash.utils.Timer;

import flash.events.TimerEvent;

var a:int=0

var timer1:Timer=new Timer(1)

timer1.start()

timer1.addEventListener(TimerEvent.TIMER,Func_time1)

function Func_time1(e:TimerEvent):void

{

    timer1txt.text=String(e.target.currentCount)

    e.updateAfterEvent();

}

//trace(timer1.running)

btn1.addEventListener(MouseEvent.CLICK,clickwhile)

function clickwhile(e:MouseEvent):void

{   a=0

    whiletxt.text=""

    while(a<20)

    {

       
whiletxt.text="loop_Number="+String(a);

        

        a++

        

    }

    

}

 


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders