Re: [flexcoders] Sleep() method
there is a lot of use for sleep function. you can try use flash.events.TimerEvent write your own sleep(). as3 doesn't have it own sleep function. Willy On 9/28/07, Paul Andrews [EMAIL PROTECTED] wrote: - Original Message - From: essuark [EMAIL PROTECTED] essuark%40yahoo.com To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Sent: Friday, September 28, 2007 9:11 PM Subject: [flexcoders] Sleep() method Is this something like a sleep or wait method? A method that holds processing for 'n' seconds? I could use a timer but that doesn't stop the processing. thanks r What processing are you trying to stop and why? -- Willy -- maybe today is a good day to write some code, hold on, late me take a nap first ... Zzzz Q: How do you spell google? A: Why don't you google it? --
Re: [flexcoders] Sleep() method
Traditionally, a sleep() function stops the code in it's tracks and then resumes after a delay. Timer Events can't give you exactly that behaviour. I can understand wanting to delay processing for a while, but in an event driven environment it may not be what's needed. Usually I associate timed events with doing screen updates for animation, or timing out some pending event that's taking too long. I was curious what the OPs intention was since they explicitly asked about stopping processing. Paul - Original Message - From: Willy Ci To: flexcoders@yahoogroups.com Sent: Tuesday, October 02, 2007 12:43 PM Subject: Re: [flexcoders] Sleep() method there is a lot of use for sleep function. you can try use flash.events.TimerEvent write your own sleep(). as3 doesn't have it own sleep function. Willy On 9/28/07, Paul Andrews [EMAIL PROTECTED] wrote: - Original Message - From: essuark [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Friday, September 28, 2007 9:11 PM Subject: [flexcoders] Sleep() method Is this something like a sleep or wait method? A method that holds processing for 'n' seconds? I could use a timer but that doesn't stop the processing. thanks r What processing are you trying to stop and why? -- Willy -- maybe today is a good day to write some code, hold on, late me take a nap first ... Zzzz Q: How do you spell google? A: Why don't you google it? --
Re: [flexcoders] Sleep() method
my guess is OP need a delay function, like after user click a button, wait three seconds, then update the screen. On 10/2/07, Paul Andrews [EMAIL PROTECTED] wrote: Traditionally, a sleep() function stops the code in it's tracks and then resumes after a delay. Timer Events can't give you exactly that behaviour. I can understand wanting to delay processing for a while, but in an event driven environment it may not be what's needed. Usually I associate timed events with doing screen updates for animation, or timing out some pending event that's taking too long. I was curious what the OPs intention was since they explicitly asked about stopping processing. Paul - Original Message - *From:* Willy Ci [EMAIL PROTECTED] *To:* flexcoders@yahoogroups.com *Sent:* Tuesday, October 02, 2007 12:43 PM *Subject:* Re: [flexcoders] Sleep() method there is a lot of use for sleep function. you can try use flash.events.TimerEvent write your own sleep(). as3 doesn't have it own sleep function. Willy On 9/28/07, Paul Andrews [EMAIL PROTECTED] wrote: - Original Message - From: essuark [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Friday, September 28, 2007 9:11 PM Subject: [flexcoders] Sleep() method Is this something like a sleep or wait method? A method that holds processing for 'n' seconds? I could use a timer but that doesn't stop the processing. thanks r What processing are you trying to stop and why? -- Willy -- maybe today is a good day to write some code, hold on, late me take a nap first ... Zzzz Q: How do you spell google? A: Why don't you google it? -- -- Willy -- maybe today is a good day to write some code, hold on, late me take a nap first ... Zzzz Q: How do you spell google? A: Why don't you google it? --
Re: [flexcoders] Sleep() method
Like this maybe? mx:Button click=handleClick(event) .../ function handleClick( event : Event ) : void { setTimeout( doButtonAction, 3000 ); } function doButtonAction() : void { trace(doButtonAction); } Cheers Ralf. On 10/2/07, Willy Ci [EMAIL PROTECTED] wrote: my guess is OP need a delay function, like after user click a button, wait three seconds, then update the screen. On 10/2/07, Paul Andrews [EMAIL PROTECTED] wrote: Traditionally, a sleep() function stops the code in it's tracks and then resumes after a delay. Timer Events can't give you exactly that behaviour. I can understand wanting to delay processing for a while, but in an event driven environment it may not be what's needed. Usually I associate timed events with doing screen updates for animation, or timing out some pending event that's taking too long. I was curious what the OPs intention was since they explicitly asked about stopping processing. Paul - Original Message - *From:* Willy Ci [EMAIL PROTECTED] *To:* flexcoders@yahoogroups.com *Sent:* Tuesday, October 02, 2007 12:43 PM *Subject:* Re: [flexcoders] Sleep() method there is a lot of use for sleep function. you can try use flash.events.TimerEvent write your own sleep(). as3 doesn't have it own sleep function. Willy On 9/28/07, Paul Andrews [EMAIL PROTECTED] wrote: - Original Message - From: essuark [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Friday, September 28, 2007 9:11 PM Subject: [flexcoders] Sleep() method Is this something like a sleep or wait method? A method that holds processing for 'n' seconds? I could use a timer but that doesn't stop the processing. thanks r What processing are you trying to stop and why? -- Willy -- maybe today is a good day to write some code, hold on, late me take a nap first ... Zzzz Q: How do you spell google? A: Why don't you google it? -- -- Willy -- maybe today is a good day to write some code, hold on, late me take a nap first ... Zzzz Q: How do you spell google? A: Why don't you google it? -- -- Ralf Bokelberg [EMAIL PROTECTED] Flex Flash Consultant based in Cologne/Germany Phone +49 (0) 221 530 15 35
Re: [flexcoders] Sleep() method
I think Ralf is right, good luck to the OP. setTimeout()function public function setTimeout(closure:Functionhttp://livedocs.adobe.com/flex/2/langref/Function.html, delay:Number http://livedocs.adobe.com/flex/2/langref/Number.html, ...http://livedocs.adobe.com/flex/2/langref/statements.html#..._%28rest%29_parameterarguments): uint http://livedocs.adobe.com/flex/2/langref/uint.html Runs a specified function after a specified delay (in milliseconds). Instead of using this method, consider creating a Timer object, with the specified interval, using 1 as the repeatCount parameter (which sets the timer to run only once). If you intend to use the clearTimeout() method to cancel the setTimeout()call, be sure to assign the setTimeout() call to a variable (which the clearTimeout() method will later reference), as in the following: var my_timedProcess:uint = setTimeout(my_delayedFunction, 1000); // ... clearTimeout(my_timedProcess); On 10/2/07, Ralf Bokelberg [EMAIL PROTECTED] wrote: Like this maybe? mx:Button click=handleClick(event) .../ function handleClick( event : Event ) : void { setTimeout( doButtonAction, 3000 ); } function doButtonAction() : void { trace(doButtonAction); } Cheers Ralf. On 10/2/07, Willy Ci [EMAIL PROTECTED] wrote: my guess is OP need a delay function, like after user click a button, wait three seconds, then update the screen. On 10/2/07, Paul Andrews [EMAIL PROTECTED] wrote: Traditionally, a sleep() function stops the code in it's tracks and then resumes after a delay. Timer Events can't give you exactly that behaviour. I can understand wanting to delay processing for a while, but in an event driven environment it may not be what's needed. Usually I associate timed events with doing screen updates for animation, or timing out some pending event that's taking too long. I was curious what the OPs intention was since they explicitly asked about stopping processing. Paul - Original Message - *From:* Willy Ci [EMAIL PROTECTED] *To:* flexcoders@yahoogroups.com *Sent:* Tuesday, October 02, 2007 12:43 PM *Subject:* Re: [flexcoders] Sleep() method there is a lot of use for sleep function. you can try use flash.events.TimerEvent write your own sleep(). as3 doesn't have it own sleep function. Willy On 9/28/07, Paul Andrews [EMAIL PROTECTED] wrote: - Original Message - From: essuark [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Friday, September 28, 2007 9:11 PM Subject: [flexcoders] Sleep() method Is this something like a sleep or wait method? A method that holds processing for 'n' seconds? I could use a timer but that doesn't stop the processing. thanks r What processing are you trying to stop and why? -- Willy -- maybe today is a good day to write some code, hold on, late me take a nap first ... Zzzz Q: How do you spell google? A: Why don't you google it? -- -- Willy -- maybe today is a good day to write some code, hold on, late me take a nap first ... Zzzz Q: How do you spell google? A: Why don't you google it? -- -- Ralf Bokelberg [EMAIL PROTECTED] Flex Flash Consultant based in Cologne/Germany Phone +49 (0) 221 530 15 35 -- Willy -- maybe today is a good day to write some code, hold on, late me take a nap first ... Zzzz Q: How do you spell google? A: Why don't you google it? --
Re: [flexcoders] Sleep() method
On Tuesday 02 Oct 2007, [EMAIL PROTECTED] wrote: there is a lot of use for sleep function. There is (as opposed to setTimeout which executes a method after a delay) ? When ? -- Tom Chiverton Helping to continuously restore dynamic design-patterns on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ * Your email settings: Individual Email | Traditional * To change settings online go to: http://groups.yahoo.com/group/flexcoders/join (Yahoo! ID required) * To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] * Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
Re: [flexcoders] Sleep() method
I have a usecase where I need to keep polling the server for a value. How can I achieve that without a sleep method? On 10/2/07, Tom Chiverton [EMAIL PROTECTED] wrote: On Tuesday 02 Oct 2007, [EMAIL PROTECTED] wrote: there is a lot of use for sleep function. There is (as opposed to setTimeout which executes a method after a delay) ? When ? -- Tom Chiverton Helping to continuously restore dynamic design-patterns on: http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links
RE: [flexcoders] Sleep() method
Two ways: function pollServer():void { //do polling here if(shouldcontinuepolling) setTimeout(pollServer,1000); } Or function pollServer():void { //do polling here } var pollInterval:uint=null; function onCreationComplete():void { pollInterval = setInterval(pollServer,1000); } Later when you need to stop polling: if(pollInterval!=null) { clearInterval(pollInterval); pollInterval=null; } _ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mayank Sent: Tuesday, October 02, 2007 8:33 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Sleep() method I have a usecase where I need to keep polling the server for a value. How can I achieve that without a sleep method? On 10/2/07, Tom Chiverton mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Tuesday 02 Oct 2007, [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] com wrote: there is a lot of use for sleep function. There is (as opposed to setTimeout which executes a method after a delay) ? When ? -- Tom Chiverton Helping to continuously restore dynamic design-patterns on: http://thefalken. http://thefalken.livejournal.com livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells. http://www.halliwells.com com. -- Flexcoders Mailing List FAQ: http://groups. http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail- http://www.mail-archive.com/flexcoders%40yahoogroups.com archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links (Yahoo! ID required) mailto:flexcoders-fullfeat mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]
RE: [flexcoders] Sleep() method
A third way is to use Timer() http://www.cflex.net/showFileDetails.cfm?ObjectID=560 Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Seth Caldwell Sent: Tuesday, October 02, 2007 12:39 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Sleep() method Two ways: function pollServer():void { //do polling here if(shouldcontinuepolling) setTimeout(pollServer,1000); } Or function pollServer():void { //do polling here } var pollInterval:uint=null; function onCreationComplete():void { pollInterval = setInterval(pollServer,1000); } Later when you need to stop polling: if(pollInterval!=null) { clearInterval(pollInterval); pollInterval=null; } From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mayank Sent: Tuesday, October 02, 2007 8:33 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Sleep() method I have a usecase where I need to keep polling the server for a value. How can I achieve that without a sleep method? On 10/2/07, Tom Chiverton [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Tuesday 02 Oct 2007, [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: there is a lot of use for sleep function. There is (as opposed to setTimeout which executes a method after a delay) ? When ? -- Tom Chiverton Helping to continuously restore dynamic design-patterns on: http://thefalken.livejournal.com http://thefalken.livejournal.com This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by The Solicitors Regulation Authority. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com http://www.halliwells.com . -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links (Yahoo! ID required) mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
[flexcoders] Sleep() method
Is this something like a sleep or wait method? A method that holds processing for 'n' seconds? I could use a timer but that doesn't stop the processing. thanks r
RE: [flexcoders] Sleep() method
No. The Flash Player is essentially single threaded, and code processing in non-blocking, so this is not possible. What are you trying to do? Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of essuark Sent: Friday, September 28, 2007 4:12 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Sleep() method Is this something like a sleep or wait method? A method that holds processing for 'n' seconds? I could use a timer but that doesn't stop the processing. thanks r
Re: [flexcoders] Sleep() method
- Original Message - From: essuark [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Friday, September 28, 2007 9:11 PM Subject: [flexcoders] Sleep() method Is this something like a sleep or wait method? A method that holds processing for 'n' seconds? I could use a timer but that doesn't stop the processing. thanks r What processing are you trying to stop and why?