Help - Search - Member List - Calendar
Full Version: does flash have a sleep function like java?
WorkTheWeb Forums > Webmaster Resources > Macromedia Flash
Support our Sponsors!
i have a problem i make a function ad sometimes it does a large process and when it runs it all the interface blocks for a moment, so i need a sleep function to stop my function for a moment and let the other movie clip run.

note sorry if i make mistakes writing, english is not my native language

Hop!
_global['sleep'] = function(nMilliseconds) {
dDate = new Date();
nCurrent = dDate.getTime();
nEnd = Number(nCurrent) + Number(nMilliseconds);
while(nCurrent < nEnd) {
dDate = new Date();
nCurrent = dDate.getTime();
}
}

Uh....all that function will do is lock up the entire Flash Player for a certain amount of time - it does not give time to other timelines. In fact, if you put a large enough value in there, you'll get the "Flash Player is running slowly" alert.

Effectively, it's a problem.

So, you can use my delayCommand function, here :

http://www.flash-france.com/forums/showthr...4094#post114094

It's in french, but ActionScript is a universal language... :)

What "sleep" does in other systems is notify the process scheduler to *suspend* the current process and give time to other processes. Your function simply puts the current process into a busy loop, giving *no* time to other processes. It's completely useless for any purpose except wasting cycles.

Scully
ActionScript may be universal but your website seems to require you to do
something, only I can't figure out what...

"> So, you can use my delayCommand function, here :
QUOTE


http://www.flash-france.com/forums/showthr...14094#post11409

4
QUOTE

It's in french, but ActionScript is a universal language... :)




PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.