A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Delaying script execution inside a function ...

  1. #1
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    117

    Delaying script execution inside a function ...

    Hi there,

    I'm in need of delaying the execution of the code in a function (or function call) writing to a .txt file by about 1 to 2 seconds as the code 'As Is' is reading and writing not the very last value on a click of a button from a text Input box, but always the second to last value.

    Any ideas would be appriciated! thanks in advance aktell

    Code:
    click="saveRunSetMsgOne(event)"
    Code:
    <mx:Script> 
    <![CDATA[
    protected function saveRunSetMsgOne(event:Event):void {  
    
         var localFile:File = File.desktopDirectory.resolvePath(".... /.... .txt"); 
    
         var localFileStream:FileStream = new FileStream();  
    
         localFileStream.open(localFile, FileMode.APPEND);
         localFileStream.writeMultiByte(Running:  + runSet1txt.text +  at  + runSet1dT.text, utf-8);  
         localFileStream.close();
    }
    ]]>
     </mx:Script>

  2. #2
    Senior Member Steven FN's Avatar
    Join Date
    Mar 2010
    Location
    CA, USA
    Posts
    276
    You can have the click call timeout or have it call another function with a timeout inside.

    setTimeout(function,3000); // 3000ms = 3 secs

  3. #3
    Senior Member
    Join Date
    Apr 2008
    Location
    Rotorua / New Zealand
    Posts
    117
    Thanks very much is working perfectly !!! Just have to think of it. regards aktell

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center